Multiple series on a line chart - can I make one line dashed?

Multiple series on a line chart - can I make one line dashed?

  

I have a line graph with two series, formatted in Highcharts. I would like to select one particular series and make the line dashed. I know I need to use some variation on

    plotOptions: {
        series: [
            marker: {
                enabled: true
            }
            dashStyle: 'Dash'
        ]
    }

I do not know how to select the series I want in particular, and the syntax I need to do this.

Any help would be greatly appreciated.

Zoe Harris

Hi Zoe,

Here's how I managed to achieve this:

  • Create two local variables as described below:
    • Data type "AdvancedDataSeriesFormat". Set the "DataSeriesName" attribute with the name of the series you want to format and the "DataSeriesJSON" attribute with the following: "dashStyle: 'ShortDash'".
    • Data type "AdvancedDataSeriesFormat List".
  • Use the "ListAppend" action to add your first variable to the second one.
  • Add the "AdvancedFormat_Init" action to your flow, and pass the list variable created above to its "DataSeriesFormats" parameter.
  • In your chart's "AdvancedFormat" property select the output parameter of the "AdvancedFormat_Init" action.

That's it!

Solution

Hello Zoe,

In order to do this, you need to create a AdvancedDataSeriesFormat List variable on the screen. If you're using OS 10, you can prepare this variable on the onReady event of the screen. On this list, append a record with the series name and the following json code:

"{dashStyle: 'longdash'}"

Then, assuming you called your list variable CustomSeriesStyle, set the AdvancedFormat parameter on your chart to something like

AdvancedFormat_Init(DataPointFormats:,DataSeriesFormats: CustomSeriesStyle, XAxisJSON:,YAxisJSON:,HighchartsJSON:)

I attached a sample application on this post, if you want to take a look.

Best of luck!
Rodrigo

Solution

Many thanks both! This is now working.

Zoe