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

Message ListMessage List     Post MessagePost Message

  Suppress legends and numbers in legends
Posted by jcl on Jul-11-2014 19:10
I'm using a finance chart and add lines and bands with funktions like "addLineIndicator2".

When I add a line, the name of the line and its last data values appears in the legend. I
want to suppress sometimes the last data values, sometimes the whole legend. How can I
do that? I tried:

LineLayer* ll = c->addLineIndicator2(....);
ll->setLegendOrder(Chart::NoLegend);

But it seems to have no effect -the name of the line layer still appears in the legend.

  Re: Suppress legends and numbers in legends
Posted by Peter Kwan on Jul-12-2014 00:04
Hi jcl,

I have just tried your code. It works normally in my case. For example, I use:

XYChart *mainChart = c->addMainChart(240);

.... add candlesticks and other indicators as usual ....

// Add a custom QQQ indicator to the main price chart
LineLayer *ll = c->addLineIndicator2(mainChart, closeData, 0xff0000, "QQQ");
ll->setLegendOrder(Chart::NoLegend);

With the above code, I cannot find the "QQQ (....)" legend key in the legend box. If I
remove the setLegendOrder line, then the legend key appears. So in my case, the
setLegendOrder(Chart::NoLegend) is working normally.

By default, ChartDirector puts the data set name in the automatic legend entry. For
FinanceChart, the FinanceChart object automatically creates the data set name to be the
indicator name followed by the last data value. You can use DataSet.setDataName to
change the data set name and hence change the legend entry. For example:

// legend entry contains only QQQ without the last data vaue
ll->getDataSet(0)->setDataName("QQQ");

Hope this can help.

Regards
Peter Kwan