Format first/last datapoint

Hi


I want to format the first and last datapoint in a series on a line chart. The line chart displays a dynamic measure split out by a hierarchy.


I want only the first datapoint in each grouping series to display a marker, and only the last datapoint in each grouping series to display a label.


Can I do this with states somehow, or a script?


Thanks

You can do it in the same way Azar explained for Top/Bottom, but use the First and Last subset formulas instead.

Great - thought there was some variation on Azar's solution but just didn't get that extra bit.


Thanks

OK, it's a bit more complicated because I have multiple measures on the axis and the formula does not aggregate.


I have come up with the following script, which I run on data change on a chart with no labels, which does the job.


//the label settings
var chartDataLabelSettings = new dundas.controls.ChartDataLabelSettings();
chartDataLabelSettings.text = "[Dynamic Measure:N0]%";
chartDataLabelSettings.placement = dundas.controls.AutoLabelPlacement.OUTSIDE;
chartDataLabelSettings.outsideAlignment = dundas.controls.AutoLabelAlignment.RIGHT;
chartDataLabelSettings.rotation = dundas.controls.AutoLabelRotation.NONE;
chartDataLabelSettings.outsideCanOverlapLabels = false;
chartDataLabelSettings.outsideCanOverlapData = true;

//put in an array
cdls = [];
cdls.push(chartDataLabelSettings)

//put into the chart
chart1.control.series[0].getPoints().forEach(function (dp)
{
//if a point x value matches the very last point x value, it is the end of a series grouping line
if (dp.xValues[0][0] === chart1.control.series[0].getPoints()[chart1.control.series[0].getPoints().length - 1].xValues[0][0])
{
//apply label settings
dp.labels = cdls;
}
}
)
chart1.control.invalidate();


Interesting workaround. Thanks for sharing, David!