@(Html.EJ().Chart("container")
//...
.PointRegionClick("onclick")
)
function onclick(sender) {
var seriesIndex = sender.data.region.SeriesIndex;
var pointIndex = sender.data.region.Region.PointIndex;
alert("xValue: " + sender.model._visibleSeries[seriesIndex]._visiblePoints[pointIndex].x + "\n" +
"yValue: " + sender.model._visibleSeries[seriesIndex]._visiblePoints[pointIndex].y+ "\n" +
"seriesIndex: " + sender.data.region.SeriesIndex + "\n" + "pointIndex: " +
sender.data.region.Region.PointIndex)
document.getElementById("text").innerHTML = sender.model._visibleSeries[0]._visiblePoints[pointIndex].x;
if (sender.model.series[0].name == "Market")
$("#container").ejChart("option", { "drilldown": pieSeries(pointIndex) });
document.getElementById("symbol").style.visibility = "visible"; }
function pieSeries(index) {
if (index == 0) {
return {
title: { text: 'Automobile Sales in the SUV segment' },
series: [{
points: [{ x: "Toyota", y: 8 }, { x: "Ford", y: 12 },
{ x: "GM", y: 17}, { x: "Renault", y: 6},
{ x: "Fiat", y: 3}, { x: "Hyundai", y: 16 },
{ x: "Honda", y: 8 }, { x: "Maruthi", y: 10 },
{ x: "BMW", y: 20 }
],
name: 'SUV-Sale', labelPosition: 'outside', enableAnimation: true,
marker: {
dataLabel: { visible: true, connectorLine: { height: 40 }, font: { size: '12px', color: "#707070" } }
}
}],
legend: { visible: false }
};
}
//..
} |
ASP.NET MVC:
@(Html.EJ().Chart("container")
.PrimaryYAxis(pr=>pr.LabelFormat("c"))
//...
)
|
@(Html.EJ().Chart("container")
axesLabelRendering: "axesLabels"
//...
)
function axesLabels(sender) {
if (sender.data.axis.orientation == "vertical") {
var text = sender.data.label.Text.toString();
sender.data.label.Text = "£" + text.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}
|