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

Message ListMessage List     Post MessagePost Message

  How to programatically extract data defined with addExtraField
Posted by John Vella on May-01-2024 08:58
I'm trying to query for the values that each of my data points has in the datasets added to a line layer. I'm using layer->addExtraField to define data used as part of the tooltips.

My need is to generate a text report that shows the extra values at each data point so it can be made part of regression tests that verify the behavior within the chart.

Say for example I have a line created by adding a dataset with 3 data points. Each data point has a unique value defined with addExtraField, specifically the data is made available to the tooltip like this:

layer->setHTMLImageMap("", "engine={dsField0}", ...);

So my question is then how to I obtain those 3 values for the "engine" field?

I'm using the C++ version of CD.

  Re: How to programatically extract data defined with addExtraField
Posted by Peter Kwan on May-02-2024 01:07
Hi John,

As your code pass the extra values to ChartDirector, you code should already have all the values. Unluckily, there is no API in ChartDirector to directly obtain those values back. If you need to audit the output of ChartDirector, one way is to search the image map (which is a just text string) for the engine=xxx pattern to confirm what is included in the image map.

Best Regards
Peter Kwan

  Re: How to programatically extract data defined with addExtraField
Posted by John Vella on May-02-2024 03:36
Ya the extraction from the HTML text string is something I have tried, but I'm not sure how to call the layer->getHTMLImageMap API in order to get the extra fields as part of the text.

Can you help me with that?

  Re: How to programatically extract data defined with addExtraField
Posted by Peter Kwan on May-03-2024 00:49
Hi John,

If you have a line with a dataset with 3 points, and each point has another unique value, It is like:

double myData[] = {111, 222, 333};
double extraValue[] = {444, 555, 666};

LineLayer *layer = c->addLineLayer(DoubleArray(myData, 3));
layer->addExtraField(DoubleArray(extraValue, 3));

The data value can be referenced as {value}, while the extra value is {field0}.

If you need the extra file in the image map, you can use:

layer->setHTMLImageMap("", "engine={field0}", ...);

Best Regards
Peter Kwan

  Re: How to programatically extract data defined with addExtraField
Posted by John Vella on May-03-2024 01:10
Peter Kwan wrote:

Hi John,

If you have a line with a dataset with 3 points, and each point has another unique value, It is like:

double myData[] = {111, 222, 333};
double extraValue[] = {444, 555, 666};

LineLayer *layer = c->addLineLayer(DoubleArray(myData, 3));
layer->addExtraField(DoubleArray(extraValue, 3));

The data value can be referenced as {value}, while the extra value is {field0}.

If you need the extra file in the image map, you can use:

layer->setHTMLImageMap("", "engine={field0}", ...);

Best Regards
Peter Kwan

Thanks for that, but how exactly do I call getHTMLImageMap and have that extra field appear in the text string that gets returned?

  Re: How to programatically extract data defined with addExtraField
Posted by John Vella on May-03-2024 01:10
Peter Kwan wrote:

Hi John,

If you have a line with a dataset with 3 points, and each point has another unique value, It is like:

double myData[] = {111, 222, 333};
double extraValue[] = {444, 555, 666};

LineLayer *layer = c->addLineLayer(DoubleArray(myData, 3));
layer->addExtraField(DoubleArray(extraValue, 3));

The data value can be referenced as {value}, while the extra value is {field0}.

If you need the extra file in the image map, you can use:

layer->setHTMLImageMap("", "engine={field0}", ...);

Best Regards
Peter Kwan

Thanks for that, but how exactly do I call getHTMLImageMap and have that extra field appear in the text string that gets returned?