Category / Section
How to change the axis name of the PivotChart in ASP.NET MVC?
You can use the following codes to change the axis title of the OLAP Chart with ChartLoad client-side event.
JavaScript
$("#OlapChart1").ejOlapChart({ url: "../wcf/OlapChartService.svc", chartLoad: " OnCustomAxisName" });
function OnCustomAxisName(args) {
this.model.primaryXAxis = { title: { text: "Your Custom Text1 Here" } };
this.model.primaryYAxis = { title: { text: "Your Custom Text2 Here" } };
}
ASP
<ej:OlapChart ID="OlapChart1" runat="server" Url="../wcf/OlapChartService.svc">
<ClientSideEvents ChartLoad="OnCustomAxisName"/>
</ej:OlapChart>
<script type="text/javascript">
function OnCustomAxisName(args) {
this.model.primaryXAxis = { title: { text: "Your Custom Text1 Here" } };
this.model.primaryYAxis = { title: { text: "Your Custom Text2 Here" } };
}
<script/>
MVC
@Html.EJ().Olap().OlapChart("OlapChart1").Url(Url.Content("~/wcf/OlapChartService.svc")).ClientSideEvents(clientSideEvent => clientSideEvent.ChartLoad("OnCustomAxisName"))
<script type="text/javascript">
function OnCustomAxisName(args) {
this.model.primaryXAxis = { title: { text: "Your Custom Text1 Here" } };
this.model.primaryYAxis = { title: { text: "Your Custom Text2 Here" } };
}
<script/>