ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Help with Stacked Bar Chart Tooltip
Posted by Susan Moore on Jul-30-2014 08:27
Hello,

I have build a Stacked Bar chart with a single layer with two data sets that shows "Expected % Complete" and "Actual % Complete".  The total size of the bar is Expected, with the Actual Value shown on the bar in a different color.  For example I might have a bar showing 95% Expected and 75% Actual Complete.  The bar would be a total height value of 95 with up to the 75 level in a different color.  I would like for the tooltip to say Expected Complete: 95%  instead of 20% (which is the current result of the following tooltip text) when hovering on the top of the bar.  When hovering over the bottom of the bar, the tooltip is correct.

The tool tip now shows as: title='{field0} - {dataSetName}: {value|0}'"

Can I have a different tooltip for each data set or can I use an extra field(s) to make this happen?

Thanks for your help,

Susan

  Re: Help with Stacked Bar Chart Tooltip
Posted by Peter Kwan on Jul-31-2014 03:28
Hi Susan,

Instead of a Stacked Bar Chart, you may try the "Overlay Bar Chart".

In a stacked bar chart, you would be using an expected value of 20 and an actual value
of 75, so that the entire bar is 95. In an overlay bar chart, you can use an expected
value of 95 and the actual value of 75. The entire bar will be the higher value of the two,
which is 95. Furthermore, when you configure the tooltip as {value|0}, the value will
show 95 and 75 (instead of 20 and 75 as in the stacked bar chart).

To create an "Overlay Bar Chart", instead of using the "Stack" constant, please use the
"Overlay" constant. For example, in Java/C#/VB.NET, simply change Chart.Stack to
Chart.Overlay.

You can provide different tooltip for each dataset. The exact method depends on what
you mean by "different tooltip". For example, if you want to add a name which is different
for each data set, but is the same for every item in the same data set, the code is:

layer.addExtraField(.....); //assume this is your existing {field0}

layer.addExtraField(anArrayOfNames); //add another extra field

title='{field0} : {dsField1}'

In the above, {field0} is your first extra field. It is different for every item in a data set,
but is the same for the same item in different data sets. For a stacked bar, it means it is
different for each bar, but is the same for all segments of the same bar. In other words,
the extra field array is indexed by the data item number.

For {dsField1},. it is the second extra field. It is indexed by the data set number. It
means it is different for each data set, but is the same for data items in the data set. It
is similar to how {dataSetName} behaves.

There is also a {dsdiFieldX} (X = a number), which is indexed by both the data item
number and the data set number. See:

http://www.advsofteng.com/doc/cdjava.htm#paramsub.htm

Hope this can help.

Regards
Peter Kwan

  Re: Help with Stacked Bar Chart Tooltip
Posted by Susan Moore on Aug-02-2014 06:56
Hi Peter,

Thanks.  The overlay bar chart did the trick.  And thank you for the info on the parameter naming conventions.  That clarified some things for me.

Best,

Susan