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

Message ListMessage List     Post MessagePost Message

  Finance chart / extra field
Posted by Mrx Rch on Jul-07-2017 09:06
Hello Peter,

  when I add an extra field for a scatter plot, then these points are shifted with the extra points needed by the finance chart.

  so,
    // adjust for extra points
    int extraPoints = std::min(candlesData.extraDays, startIndex);
    startIndex -= extraPoints;
    int noOfPoints = endIndex - startIndex + 1;
    ...
    ScatterLayer *openLayer = myMainChart->addScatterLayer(DoubleArray(), openSignal, "Open", Chart::ArrowShape(0, 1, 0.4, 0.4),
        11, 0x00ffff);
    openLayer->addExtraField(info);
    openLayer->setHTMLImageMap("clickable", "", "title='[{dataSetName}] Value = {value}, n{xLabel|yyyy-mm-dd, hh:nn}n{field0}'");

  ... => so, the info data is set back with extraPoints compared to OHLC chart.

  (
DoubleArray timeStamps = DoubleArray(candlesData.timeStamps.data + startIndex, noOfPoints);
... for OHLC
DoubleArray openSignal = DoubleArray(logData.openSignal.data + startIndex, noOfPoints);
  )

if I set candlesData.extraDays = 0, then the extrafield info is ok, but then the very first points on the chart are not correct (for SMA, and other indicators)

  am I missing something?

thx,
  Rch

  Re: Finance chart / extra field
Posted by Peter Kwan on Jul-08-2017 15:16
Hi Mrx Rch,

You need to shift the "timeStamps" and "openSignal". However, you do not need to shift the extra field "info".

When you add the extra field "info", ChartDirector does not know whether they are associated with data points or data sets and/or both, or axis labels or some other things. (The "{field0}" means the extra field is indexed with the data array index. There are other supported association such as {dsField0} and {dsdiField0} for other indexing methods.) In the current implementation, the extra field simply ignores the "extra points" parameter.

Regards
Peter Kwan

  Re: Finance chart / extra field
Posted by Mrx Rch on Jul-08-2017 19:20
thank you very much Peter!

it makes perfectly sense (i shifted to left the info (field0) by number of extra points and now everything is in sync).

br, Rch