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

Message ListMessage List     Post MessagePost Message

  setHTMLImageMap() replace values
Posted by Medic89 on Aug-02-2022 23:48
Hello Peter,

I have values in an XY chart which is displayed in a table. the y-axis of the the data point is a number on the y-Axis (first line is 0.5, second 1.5 and so on). When I use the onClickHotspot function and check the data thats been retrieved, it displays the y-Axis value of my data point. But actually, each tick on the y-Axis has a custom label with the actual value. is it possible, to display the name of the datalabel of the tick instead of the numeric value of the tick?

  Re: setHTMLImageMap() replace values
Posted by Peter Kwan on Aug-03-2022 15:39
Hi Medic89,

For your case, you may add the y labels as an extra field to your data points, and include that extra field in setHTMLImageMap.

For example, suppose the points on your line are added as a LineLayer, like:

LineLayer *layer = c->addLineLayer(......);

You can add the labels using:

layer->addExtraField(StringArray(yLabelsArray, yLabelsCount));

The labels array should be of the same size as the data array used in addLineLayer. Each label corresponds to one data point.

The extra field is represented as {field0} in setHTMLImageMap ({field0} refers to the first extra field. If you have more extra field arrays, then are {field1}, {field2}, ....).

layer->setHTMLImageMap("clickable", "xLabel={xLabel}&yLabel={field0}&y={value}");

In the above, I pass the x-axis label, the extra field, and the data value (the y-value) to the image map, so they will be available as the parameter "xLabel", "yLabel" and "y" in onClickHotSpot.

Best Regards
Peter Kwan

  Re: setHTMLImageMap() replace values
Posted by Medic89 on Aug-05-2022 21:41
Hello Peter,

I tried tho impement your code, it works so far, however, when I check the tooltips for my datapoints, the value for dsField0 stays alway the same, although the value inside the array (ExtraInfo0A) are correct. I entered the extra data as following:

gruppeGesamt->addExtraField(StringArray(&(ExtraInfo0A[0]), ExtraInfo0A.size()));
        gruppeGesamt->addExtraField(StringArray(&(ExtraInfo0B[0]), ExtraInfo0B.size()));


viewer->setImageMap(alles->getHTMLImageMap("clickable", "x={x}&dsField0={dsField0}&field1={field1}&dataSetName={dataSetName}&value={value}&dataItem={dataItem}", "title='{dsField0}: {field1} um {x|hh:nn} Uhr'"));

Do you have an explanation, on whats wrong here?

  Re: setHTMLImageMap() replace values
Posted by Peter Kwan on Aug-07-2022 16:07
Hi Medic89,

Note that the {dsField0} (or {dsFieldN}) uses the data set number as the index, while {field0} (or {fieldN}) uses the array index as the index. You can think of {field0} as associated with the array index of the data points, while {dsField0} as associated with the data set in a layer.

For example, consider the Multi-Line Chart (1) sample code:

https://www.advsofteng.com/doc/cdcpp.htm#multiline.htm

In the above chart, there is one LineLayer. The LineLayer has 3 data sets. Each data set has 25 data points.

If you use {field0}, then the first data point of all three data sets will have the label from the first element of the extra field, the second data point of all three data set will have the label from the second element of the extra field.

If you use {dsField0}, then all 25 data points in the first data set will have the label from the first element of the extra field, and all 25 data points in the second data set will have the label from the second element of the extra field.

For your case, I am not sure how you layers are arranged. If you have three lines in 3 line layers (instead of one layer containing 3 lines), then each layer only has one data set. Your would have to call addExtraField 2 x 3 times for the three layers, each with 2 extra fields. For the {dsField0}, only the first element is used, because each layer only has one data set. So the first extra field is supposed to contain 1 element, which is the label you want to use for the layer.

If the above still does not solve the problem, would you mind to clarify how your layers and data sets are arranged?

Regards
Peter Kwan

  Re: setHTMLImageMap() replace values
Posted by Medic89 on Aug-10-2022 20:35
Thank you Peter, it works with {field0} and {field1}!

One more question:

On a printout I use the setBgImage() method to add a background image which works fine. However, I now want to change the background image, but when I call the setBgImage() function again, nothing happens (I suppose, the new Image is placed behind the first one).

I have a data set, which has to be printed on 3 pages, the data is identical, but on each page is a different background picture. So I put all the data to one chart, add the bg Image, then I add the page, but how can I change the image?

  Re: setHTMLImageMap() replace values
Posted by Peter Kwan on Aug-11-2022 03:14
Hi Medic89,

In general, you cannot change anything that has already been drawn. For your case, you can draw another chart with a different background image. You can structure your charting code to take a background image as a parameter, and call the same code multiple times with different background image parameters.

Best Regards
Peter Kwan