|
ASP.NET Core
[Controller]:
ChartProperties chartModel = new ChartProperties();
InitializeChart(chartModel);
//Passing chart properties in the ViewData
ViewData["ChartModel"] = chartModel;
private void InitializeChart(ChartProperties chartModel)
{
chartModel.Loaded = "chartLoaded";
//...
}
[View page]:
@{Html.EJ().Chart("container", (Syncfusion.JavaScript.DataVisualization.Models.ChartProperties)ViewData["ChartModel"]).Render(); }
function chartLoaded(sender) {
//Chart model properties
var chartModelProperties = sender.model;
var xAxisText = $("#" + this._id + "_svg_XAxisLabels_0")[0];
//Change this condition with respect to your scenario
for (var i = 0; i < xAxisText.children.length; i++) {
var currentText = xAxisText.children[i].innerHTML;
if (currentText == "Jan") xAxisText.children[i].setAttribute("fill", "Red");
//...
}
}
|
| ASP.NET Core [Controller]: ChartProperties chartModel = new ChartProperties(); InitializeChart(chartModel); //Passing chart properties in the ViewData ViewData["ChartModel"] = chartModel; private void InitializeChart(ChartProperties chartModel) { chartModel.Loaded = "chartLoaded"; //... } [View page]: @{Html.EJ().Chart("container", (Syncfusion.JavaScript.DataVisualization.Models.ChartProperties)ViewData["ChartModel"]).Render(); } function chartLoaded(sender) { //Chart model properties var chartModelProperties = sender.model; var xAxisText = $("#" + this._id + "_svg_XAxisLabels_0")[0]; //Change this condition with respect to your scenario for (var i = 0; i < xAxisText.children.length; i++) { var currentText = xAxisText.children[i].innerHTML; if (currentText == "Jan") xAxisText.children[i].setAttribute("fill", "Red"); //... } } |
|
Query |
Response | |
|
Performance |
Regarding the performance lags in chart, we have updated the details in the forum 135230, so kindly follow up with the forum 135230 for further details.
| |
|
Customize the XAixs label's font color |
As of now, when you specify the font color in the axis, then all the axis labels will render with the specified color. If you need to customize the color for each label, then it is possible only with client side events as stated earlier in our previous update (1/3/2018).
Kindly find the code snippet to specify the axis label color below.
So, kindly customize the axis label color using the client side events.
|