So i have a simple bar chart based on the first 2 columns, the reason and the minutes. I would like to change the colour depending on the owner of that issue (the 3rd column)
I can change the color based on valve but I want to change it based on the owner. I created a custom dataset on the chart hoping I could define the owner for color but cant get it to work. There will only ever be two owners.
To figure this out in my mind, the bar chart works basically on 2 values. A option like days of the month and a value.
2 variables. How do I add the 3 variable which is what will determine the colors.
On the database table the machine break down reason has a 3rd column called owner. It will either be my company or the client. How do I pull that owner into the bar chart.
I set up a custom property dataset on the bar chart with the 3 columns so i can see the owner when I view the data set, Along with the reason and minutes.
Using your example would I use
if self.data.getValueAt(category, 'Owner') == 'SS7':
return Color.GREEN
else:
return Color.BLUE
I’m Just confused as ‘owner’ is not an actual value used on the bar chart. Only in the table the data comes from.
Are you binding the custom dataset to a SQL query? In that case, you can bind the data property of the chart to only the first 2 columns of the dataset, then use my example to look at the value of the owner column in the custom dataset.
I created a custom dataset called customDS that looks like this:
Next, I used an expression binding on the chart data to get the first 2 columns: