This topic is locked

JavaScript Chart Modify - Manipulating Each Series

5/22/2024 5:48:31 PM
PHPRunner General questions
V
valdaure author

Hi All,

I've been struggling with modifying charts using JavaScript Chart Modify in PHPRunner 10.8.

My chart is based on the following data:

img alt

The X axis displays the month. I want the first two data series (bar_sales, kitchen_sales) to display as a stacked column. But I want the third and fourth data series (bar_margin, kitchen_margin) to display as a line, referring to a separate Y-axis percent scale to the right of the chart. I can insert the additional Y-axis to the right with no problem.

However, I am struggling to force the the third and fourth data series to present as a line.

I tried choosing chart type 'Combined' within PHPRunner, but the presentation type applied to each series seems arbitrary and I didn't find how to define the type for each series. So I resorted to a stacked column, thinking I could redefine the presentation of individual series, but with no luck.

It is not clear to me, within JavaScript Chart Modify, what variable contains the full dataset. This prevents me from using much of the sample code provided by AnyChart, such as:

var firstSeriesData = dataSet.mapAs({ x: 0, value: 1 });

... because I don't know the real variable name for 'dataSet' within the scope of JavaScript Chart Modify.

Even trying to redefine the type and scope of a data series using something like the following does not work to force a line presentation of that series:

var series2 = chart.getSeriesAt(2);
series2.type("line");

Obviously, PHPRunner is pre-setting much of the presentation of the data series based on the chart type selected. But How can that be overridden on a per series basis? Knowing the variable to refer to in order to access the full dataset would be a good start. Knowing how to change the type and mapping for each series within that dataset would be a huge help.

I'm sure the solution is simple, and I'll be kicking myself for not finding it alone. But after hours of trying, I'm resorting to asking for help. Thanks in advance.