This is the first time I have ever worked with a chart of any kind and I am struggling a bit to find a way to do the simple things I want to do. I know there must be a property somewhere, but I have not found it. I am using a stacked column chart. The first issue that I am trying to resolve is when there are multiple data values stacked, when I hover over each area, the tooltip displays a cumulative number (a sum) as you move up the stack instead of displaying the actual data value for that area. For example, if I have a stack made up of 3 areas, the first value is 5, the second value is 10 and the third value is 5, when I hover over the bottom area, the tooltip is 5, but when I hover over the second area, the tooltip is 15. I expect this to be 10. When I hover over the third area, the tooltip is 20. I expect this value to be 5. What do I need to do to get this expected behavior? Also, I need to add some additional text to the tooltip and see that I should be able to use the FillSceneGraph method to accomplish this, but I’m having difficulty finding the primitives for the boxes that make up my stack. Is there a good tutorial somewhere that will enable me to familiarize myself with the stacked column chart and how to work with it? I have been through the forum and I’m still going through it, but thought I would go ahead and get my questions out there to see if I could get some help. Thanks, Sabrina
Hello Sabrina.
By default, the StackedColumn chart will display the aggregate values for the column. To modify the tooltip to display the value of each individual item, you can change the chart's Tootips.FormatString to "<DATA_VALUE_ITEM>".
this.ultraChart1.Tooltips.FormatString = "<DATA_VALUE_ITEM>";
If you want to add custom text to the tooltip, you'll need to utilitize the IRenderLabel interface. The basis to this mechanism is you implement an ToString() method for this interface, and associate the interface implementation with a string token. When the chart encounters this token in the FormatString properties, it will call the ToString() method. I've attached simple sample that demonstrates using the interface.
If you haven't already found it, here is a link to our online help for the UltraChart.
Let me know if you have any further questions.
Chris
OMG, this is awesome! This really was helpful. I was just having trouble finding information to help me put this together. These responses were exactly what I needed. The only remaining issue is that one of the things I want to put into the tooltip is the percentage that each data_value_item is to the total (data_value), but it looks like the data_value is unaware of the stack as a whole at the bottom of the stack. So if I have a stack of 2 items, the bottom item is 4 and the other is 7, when I hover over the bottom item, I get 100%. My expectation is that would be 37%. Is there a way to resolve that?
Thanks
Sabrina
I do believe the items included in the context hashtable are based on the chart-type. For the Stack3DColumnChart, the DATA_VALUE is the equivalent to the DATA_VALUE_ACCUMULATED_ELEMENT of other chart-types.
Let me know if this helps.
I have modified the sample and recreated the issue and attached it here. I did fail to mention that my chart is 3D. Is that the reason I don't see DATA_VALUE_ACCUMULATED_ELEMENT? If that is the case, is there a reason why it's not included for that type of chart because it would certainly be beneficial in the 3D context as well.
Thanks, Sabrina
I got it to work. I wrote a bit of code to get the accumulated value manually.
Thanks so much for all your help. It really made all the difference in allowing me to move forward.
Hello Sabrina,
I can't see any reason that the DATA_VALUE_ACCUMULATED_ELEMENT would not exist in the context hashtable. Glancing at the code, DATA_VALUE, DATA_VALUE_ITEM and DATA_VALUE_ACCUMULATED_ELEMENT are added for all Stacked chart types. To figure out why they are not available in your application, I'd need a sample that reproduces the issue. See if you can modify the previously attached sample so it reproduces the problem.
Thanks,
In the debugger, the following is what I have in Context. Is the DATA_VALUE_ACCUMULATED_ELEMENT not there because of the way I am loading my table/chart? I don't see anything in the documentation that explains how I might insure that I get this value in the context hashtable. Any ideas would be greatly appreciated.