Data Charts Legends labels order

Data Charts Legends labels order

  

Hi,

We have stacked charts with a legends and would like to set custom order for legend labels (not default alphabetical). On highchairs there is a "legendIndex" parameter that can be applied to the series. However it seems to have no effect if I put in "Advanced Format" this values:

"...

series:[{    name:'<25',    legendIndex:0},

{    name:'26-35',    legendIndex:1},

{    name:'36-50',    legendIndex:2},

{    name:'>50',    legendIndex:3}

]"....

Are they are overrides by default values?

We use data point list with a series name associated with each data point. 



I've also tried on Pie chart {legendIndex: 1} in AdvancedDataPointFormat.DataPointJSON so I have a list of datapoint with advanced JSON containing legendIndex but it has no effect on the chart - labels are still ordered by value ascending.


Thank you,

Nick


Hi Nick,

I created an example that you can use to test: https://jsfiddle.net/hywm0cva/. The "legendIndex" works in this case. 

As an alternative, you can use the highcharts javascript directly instead of the Outsystems Charts.

Kind Regards,

Paulo


Hi Paulo,

Thank you for example. I've also created a test oml and it is working fine in this flow - I'll try to reuse it on real project. 

I've tried use highchairs javascript directly but got errors like:

Highcharts.chart is not a function. (In 'Highcharts.chart', 'Highcharts.chart' is undefined)
 and
undefined is not an object (evaluating 'this.init.apply') if I try use Highcharts.Chart ... 


Regards,

Nick

Solution

Hi Nick,

I uploaded an example using the javascript directly to create a chart.

Kind Regards,

Paulo Reis

Solution