104
Views
3
Comments
[OutSystems Charts] Charts v3.3.0 Line graph - How to set line color via SetHighchartsSeriesConfigs addon
outsystems-charts
Reactive icon
Forge asset by OutSystems
Application Type
Reactive
Service Studio Version
11.54.40 (Build 63053)
Platform Version
11.18.1 (Build 37828)

Hi Community Experts, I am building a complex line chart that allows the end user to selectively add multiple lines to a line chart. As part of the requirement I need to set the line series properties, such as line colour, amongst other things. 

Because the number of lines on the graph can be changed by the end user, from just 1 line to many lines, I need to be able to add and remove lines dynamically including changing the properties of each line 'series'.

While my graph is generally working I am struggling to set the 'series' properties via the provided SetHighchartsSeriesConfigs addon action.

To show the issue I am facing, I have attached here a simple line chart example of the issue (see ChartTest.oml). This example draws a line graph with 2 lines. It then attempts to set the line color to red for the series named 'MyOtherSeries'. 

I cannot get the line color to change from orange to red, could you show me how to do this and preferably modify the attached OML so I can see the fine details of how this works. 

In the attached OML the DataPoints list is first created in the action 'SetChartData'. This is automatically followed by a OnAfterFetch action named 'OnAfterChartData' to change the line colour to red, using the SetHighchartsSeriesConfigs addon action.

You will notice in the 'OnAfterChartData' action, the SetHighchartsSeriesConfigs PropertyValueList I have tried a variety of permutations for the 'PropertyPathList' including combinations of; 

  • series
  • type
  • line
  • color

You help would be much appreciated!

Regards, John.

ChartTest.oml
2024-05-08 06-29-37
Prince Aadil Khan Panwar

Hi @John Robinson 

you forgot to give styling to the each series. as you have dynamic list of records so try to put the list element in chart addons and take series style element like that 


for random color am generating random 6 digit number and attaching with # and assigning it to back into the on after fetch action like this.

attaching fixed oml.

 sample - click here

mark my reply as solution if you find it appropriate.

Thanks

Prince

ChartTestfixed.oml
UserImage.jpg
John Robinson

Hi Prince, many thanks for a quick answer on this one. I think your solution is providing an alternate method to set the colour of the 'DataPoints' but it does not change the 'series' line to the specified colour. 

If you refresh your solution several times you will see the 'datapoints' are changing to the specified colour, but 'line' colour that goes through all the datapoints is not set to the specified colour.

The other point here is I really need to change the properties of the selected 'Series' as there are many other properties that ultimately may need changing as well as the line colour. 

I really need to get the 'SetHighchartsSeriesConfigs' addon action working for me.

Regards, John. 


2024-05-08 06-29-37
Prince Aadil Khan Panwar

yes. when you refresh it changes the color of data points. i have just given you idea this way you can do it. You can do one thing when you create the records then save the color of lines also into the database it will reflect this way.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.