Chart conditional formatting based on value from other column of dataset

Stimulsoft Reports.PHP discussion
Post Reply
pvb
Posts: 11
Joined: Tue Oct 13, 2020 3:40 pm

Chart conditional formatting based on value from other column of dataset

Post by pvb »

I have a dataset like this:

Code: Select all

Col1, Col2
0.5,   1.3
1,     2.0
0.6,   2
3,     1
I want to do bar chart for Col1 with condition that bars are red when Col2 > Col1, and green otherwise. In the case above only last pair do not fulfill the condition, so first 3 columns will be red and the last one will be green. So I want to have result simillar to this (different case than data above):
Chart1.png
Chart1.png (12.22 KiB) Viewed 5183 times
My question is how can I construct conditional formatting of one column using comparition with other column? In Report Designer I suceeded only using constant value. Is it possible to use datasource field value for comparition?
Lech Kulikowski
Posts: 7019
Joined: Tue Mar 20, 2018 5:34 am

Re: Chart conditional formatting based on value from other column of dataset

Post by Lech Kulikowski »

Hello,

Unfortunately, it is not possible.

Thank you.
pvb
Posts: 11
Joined: Tue Oct 13, 2020 3:40 pm

Re: Chart conditional formatting based on value from other column of dataset

Post by pvb »

Hello, thank you for the answer.

So I ask again - is there any other way to control the color of individual bar in one of data series? For example I can do the comparition while retrieving data and then pass resulted color in my dataset together with data, as hex or any other way. Like the JSON code bellow. First value is height of the bar, second is the color of the bar.

Code: Select all

{
  "data": [
    {
      "value": 10,
      "color": "green"
    },
    {
      "value": 20,
      "color": "green"
    },
    {
      "value": 12,
      "color": "red"
    }
  ]
}
Lech Kulikowski
Posts: 7019
Joined: Tue Mar 20, 2018 5:34 am

Re: Chart conditional formatting based on value from other column of dataset

Post by Lech Kulikowski »

Hello,

Unfortunately, at the current moment, it is not possible.

We have added this task in our to-do list.

Thank you.
#14967
pvb
Posts: 11
Joined: Tue Oct 13, 2020 3:40 pm

Re: Chart conditional formatting based on value from other column of dataset

Post by pvb »

Thank you.
Lech Kulikowski
Posts: 7019
Joined: Tue Mar 20, 2018 5:34 am

Re: Chart conditional formatting based on value from other column of dataset

Post by Lech Kulikowski »

Hello,

You are welcome.
Post Reply