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

Message ListMessage List     Post MessagePost Message

  Removing Legend from Finance charts
Posted by redblue on May-26-2019 21:38
Attachments:
Hi,

I am trying to remove the Legend from Finance charts, but failing. Searching this forum gave me this answer:

c->setLegendStyle("normal", 8, Chart::Transparent, Chart::Transparent);

Which seemed to work, but the space for the Legend is still there making the chart look wrong for small charts. See attached image.

I also tried, box setSize as in:

        XYChart* rsiChart =c->addLineIndicator(100, DoubleArray(rsi,bars), 0xcc0000, rsiLable);
        rsiChart->yAxis()->setLinearScale(0,100);
        rsiChart->yAxis()->addMark(30, 0x000000);
        rsiChart->yAxis()->addMark(70, 0x000000);

        LegendBox* box = rsiChart->getLegend();
        box->setSize(0, 0);


But this didn't seem to do anything.

Thoughts?

Regards,

red.
26-05-2019 14-22-27.png

  Re: Removing Legend from Finance charts
Posted by Peter Kwan on May-27-2019 14:04
Hi redblue,

The space you mentioned in due to the y-axis margin, which shorten the scale of the y-axis a little bit. So there is an empty region with no scale at the top. If you set the y-axis margin to 0, the gap will disappear.

https://www.advsofteng.com/doc/cdcpp.htm#FinanceChart.setYAxisStyle.htm

In the default implementation of the FinanceChart, we put the legend box inside the plot area at the top. This can cause the legend box to overlap with the chart contents. So we also set an axis margin to leave some empty space at the top.

Hope this can help.

Regards
Peter Kwan