$.ajax({
type: "GET",
url: '@Url.Action("AvergParticipantPoint", "Common", new{area= "" })',
dataType: 'json',
success: function (response) {
AvgDataPointPar.push(response);
}
ParticipantChart.options.axisY.stripLines[0].label = AvgDataPointPar;
ParticipantChart.options.axisY.stripLines[0].value = AvgDataPointPar;
});
ParticipantChart.render();
},
error: function (xhr, status, error) {
alert("Error");
}
});
-----------------------------------------------------
var ParticipantChart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
backgroundColor: "#fcfcfc",
title: {
//text: "Participation Points Per Session"
},
axisX: {
// title: "Participation Points Per Session",
labelAngle: -90,
labelFontColor: "#000",
interval: 8,
labelMaxWidth: 100
},
axisY: {
gridThickness: 0.1,
// title: "Number of Visitors",
scaleBreaks: {
autoCalculate: true
},
stripLines:[
{
lineDashType: "longDash",
thickness:2,
color: "#006400",
label: "Average Participation Points" + "-" + AvgDataPointPar,
labelFontColor:"Black",
//labelPlacement: "outside",
value: AvgDataPointPar,
showOnTop: true
}
]
},
toolTip: {
shared: true,
reversed: true,
},
dataPointWidth: 8,
data: [
{
// Change type to "doughnut", "line", "splineArea", etc.
markerType: "circle", //"circle", "square", "cross", "none"
markerColor: "#4f9fee",
type: "column",
showInLegend: true,
name: "Participation Points",
//name: "Average Participation Points",
color: "#4f9fee",
dataPoints: DataPointPar
// [
// { label: "Classifying Num...", y: 10 },
// { label: "Repeating Decim...", y: 15 },
// { label: "Compare irration", y: 25 },
// { label: "Graph irration", y: 30 },
// { label: "Value of irration", y: 28 },
// { label: "Properties of E", y: 1 },
// { label: "Square & Cube R", y: 3.06 },
// { label: "Scientific Nota", y: 2.94 },
// { label: "What is Slope", y: 10 },
// { label: "Topic 10 Name", y: 12 },
// { label: "Topic 11 Name", y: 14 },
// { label: "Topic 12 Name", y: 9 },
// { label: "Topic 13 Name", y: 20 },
// { label: "Topic 14 Name", y: 25 },
// { label: "Topic 15 Name", y: 30 },
// { label: "Topic 16 Name", y: 35 },
// { label: "Topic 17 Name", y: 5 },
// { label: "Topic 18 Name", y: 6 },
// { label: "Topic 19 Name", y: 7 },
// { label: "Topic 20 Name", y: 8 },
// { label: "Topic 21 Name", y: 5 },
// { label: "Topic 22 Name", y: 3 },
// { label: "Topic 23 Name", y: 6 },
// { label: "Topic 24 Name", y: 30 },
// { label: "Topic 25 Name", y: 40 },
// { label: "Topic 26 Name", y: 41 },
// { label: "Topic 27 Name", y: 39 },
// { label: "Topic 28 Name", y: 5 },
// { label: "Topic 29 Name", y: 8 },
// { label: "Topic 30 Name", y: 11 },
// { label: "Topic 31 Name", y: 12 },
// { label: "Topic 32 Name", y: 13 },
// { label: "Topic 33 Name", y: 14 },
// { label: "Topic 34 Name", y: 17 },
// { label: "Topic 35 Name", y: 18 },
// { label: "Topic 36 Name", y: 19 },
// { label: "Topic 37 Name", y: 21 },
// { label: "Topic 38 Name", y: 22 },
// { label: "Topic 39 Name", y: 23 },
// { label: "Topic 40 Name", y: 24 }
//]
},
]
});
public ContentResult AvergParticipantPoint()
{
int studentID = 0;
int? gradeID = 0;
var loginID = Convert.ToInt32(Session["LOGIN_ID"]);
if (!string.IsNullOrEmpty(Convert.ToString(Session["SelectedStudentID"])) && Convert.ToString(Session["RoleName"]) == "Parent")
{
studentID = Convert.ToInt32(Session["SelectedStudentID"].ToString());
gradeID = _context.FEV_STUDENT.Where(x => x.STUDENT_ID == studentID).FirstOrDefault().GRADE_ID;
}
else
{
studentID = _context.FEV_STUDENT.Where(x => x.LOGIN_ID == loginID).FirstOrDefault().STUDENT_ID;
gradeID = _context.FEV_STUDENT.Where(x => x.LOGIN_ID == loginID).FirstOrDefault().GRADE_ID;
}
var Reportdetails = (from tfb in _context.FEV_OLTSESSION_TUTOR_FEEDBACK
join stu in _context.FEV_STUDENT on tfb.STUDENT_ID equals stu.STUDENT_ID
where stu.STUDENT_ID == studentID & stu.GRADE_ID == gradeID
select new AvergParticipantAjaxcall
{
X = tfb.LESSON_OBJECTIVE,
y = tfb.PARTICIPATION_POINTS
}).ToList();
List<AvergParticipantAjaxcall> rept = new List<AvergParticipantAjaxcall>();
var p = Reportdetails.Select(a => a.y).Average();
JsonSerializerSettings _jsonSetting = new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore };
return Content(JsonConvert.SerializeObject(p, _jsonSetting), "application/json");
}
https://ibb.co/vYDfSKT
Hi I want to bind a value dynamically to a stripline but it is not working and it is affecting to other graphs also.
could you please help me?