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

Message ListMessage List     Post MessagePost Message

  How to add different tool tips and hyperlinks on a clickable multibar chart?
Posted by Lilian on Sep-15-2012 05:31
Attachments:
I have created a clickable XY Bar chart to compare two entities. Now I need to create a clickable XY chart to compare these two in more than one year.

To be simple, let us say to compare the height growth of John and Ben in three years.
There will be two groups of bars with three bars in each group on the multi-bar chart.

How can I add the tool tips and different links on each bar in the order from left to right?

John School Year 0
John School Year 1
John School Year 2
Ben School Year 0
Ben School Year 1
Ben School Year 2

For now, I tried to add the data values in labelsBar & BarLink which are string arrays, but the tool tips and links only show the first data value for the first group of three bars and the second data value for the second group of three bars.

I tried to create labelsBar1, labelsBar2 & BarLink1 and BarLink2 but did not work.

Any hints on are appreciated. Thanks.

Here are my codes to create the multi bar chart and show tools and links:


// Add a multi-bar layer with 3 data sets and 3 pixels 3D depth
            BarLayer barLayer = c.addBarLayer2(Chart.Side, 3);
            barLayer.addDataSet(Data, 0xff8080, "SchoolYear 0");
            barLayer.addDataSet(Data1, 0x80ff80, "SchoolYear 1");
            barLayer.addDataSet(Data2, 0x800060, "SchoolYear 2");

// add the different hyperlinks
            barLayer.addExtraField(labelsBar);
            barLayer.addExtraField(BarLink);
            showText = "onclick='showInfo(\\"{xLabel}\\", \\"{field1}\\");' ";

// output the chart
            ChartViewer.Image = c.makeWebImage(Chart.PNG);
            ChartViewer.ImageMap = c.getHTMLImageMap("", "", showText + toolTip);
Demo1.jpg

  Re: How to add different tool tips and hyperlinks on a clickable multibar chart?
Posted by Peter Kwan on Sep-18-2012 01:16
Hi Lilian,

As you have 3 data arrays Data, Data1, Data2, you would need to have 3 extra fields arrays for the labels for the 3 data arrays. If you need to use extra fields for the links as well, you would also need to have 3 extra fields array for the lines for the 3 data sets. The code is like:


barLayer.addExtraField(labelsForData);
barLayer.addExtraField(labelsForData1);
barLayer.addExtraField(labelsForData2);

barLayer.addExtraField(linksForData);
barLayer.addExtraField(linksForData1);
barLayer.addExtraField(linksForData2);

Then in the getHTMLImageMap template, you can use {dsdiField0} for the labels, and {dsdiField3} for the links (the links start at the 4th extra field, so the index is 3).

Hope this can help.

Regards
Peter Kwan

  Re: How to add different tool tips and hyperlinks on a clickable multibar chart?
Posted by Lilian on Sep-22-2012 05:47
Thanks. It works out very well.