Parameter or Calculated Field called in HighChart code

Hi! I’m trying to build a chart in HighCharts where the user can changer a parameter control, and that choice reflects in the chart. So, for example, I want to the user to be able to choose the colour of the line. So i’ve given them three parameter controls for Red, Blue, and Green, between 0 and 255. And then I want the colour of the line to change based on what they choose. I’m sure I’ve done the right research here, and have the series colour calling a calculated field like this:

“color”: “${TargetLine1RGBColor}”

The calculated field concats the three parameters into the form. “rgb(x,x,x)”. I know it works because when i create a table and add that field, the output is exactly what I want and changes as i change the parameters.

It works perfect when i insert “rbg(255,0,0)” into the code so i know it’s working when i hard code a colour in.

Anyone have any suggestions?

Thanks!

Hi @jeff.neubeker ,

given that your param are Red, Green, Blue, I’ve created a calculated field called TargetLine1RGBColor which is concat("rgb(", toString(${Red}), ",", toString(${Green}), ",", toString(${Blue}), ")").

I’ve then added it to the visual I’m editing in HighChart.

It’s the second in the order, so I’ll have to refer to is as getColumn=1.

The code for my simple line chart is then this one:

{
  "xAxis": {
    "categories": ["getColumn", 0]
  },
  "series": [
    {
      "type": "line",
      "data": ["getColumn", 2],
      "name": "MySeries",
      "color": ["get",["getColumn", 1],0] 
    }
  ]
}

keep an eye on this part: "color": ["get",["getColumn", 1],0] which means get the first value of the series (my calculated field will have the same value for all the lines).

When changing the controls, I’m able to change the line color :slight_smile:

Let me know if this helps!

Andrea

Hi @jeff.neubeker

It’s been a while since we last heard from you. If you have any further questions, please let us know how we can assist you.

If we don’t hear back within the next 3 business days, we’ll proceed with close/archive this topic.

Thank you!

Hi @jeff.neubeker

Since we have not heard back from you, I’ll go ahead and close/archive this topic. However, if you have any additional questions, feel free to create a new topic in the community and link this discussion for relevant information.

Thank you!