on 09-25-2008 2:51 AM
I am creating a stacked bar chart by using the following data:
Date Column1 Column2 Color1 Color2
09-22-08 10.92 00.00 red green
09-23-08 11.53 00.00 red green
09-24-08 60.81 -27.45 blue yellow
09-25-08 67.24 -25.81 blue yellow
09-26-08 56.63 33.36 blue green
09-29-08 91.26 12.00 blue green
I could set Color1 and Color2 as hexadecimal. . The Value Columns are Column1 and Column2 and I have added Color1 and Color2 to the datalink columns.
What I would like to do is to dynamically set the color of Pen1 and Pen2 based on the value of Color1 and Color2.
In the 'UpdateEvent', I am able to loop through the datapoints by using getDatalinkValue(1,LoopIndex,1) and getDatalinkValue(1,LoopIndex,2) to see values of Color1 and Color2 for each of the bars.
But How do I use/apply the setColor for both pens in each bar (could be a different combination)?
Thanks,
Glen
Glen,
In your stacked bar you will have 2 pens in the legend for your Column1 and Column2 ValueColumns, and the chart can only provide colors on a pen by pen basis (so 2 colors max in this example).
If you can arrange the results of your query like this (db stored procedure or BLS TRX) then the pen colors will be fixed by the display template itself, but the null value stacked bar slice values will be 'invisible'.
Date RedCol GreenCol BlueCol YellowCol
09-22-08 10.92 00.00 null null
09-23-08 11.53 00.00 null null
09-24-08 null null 60.81 -27.45
09-25-08 null null 67.24 -25.81
09-26-08 null 33.36 56.63 null
09-29-08 null 12.00 91.26 null
You'll see the data set as a sort of squared matrix where the numerical value falls into the pen color that it belongs. Obviously this requires a bit more data handling, but it should allow you to get the desired results. Assuming you want to name your 4 columns a bit more logical to the color's purpose you just need to map all 4 of them into your value columns. If you are using a query make sure to use a null as a cell placeholder in the resultset, and if using BLS then use the nullnumber function from the list in the expression editor.
Regards,
Jeremy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
6 | |
3 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.