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

Message ListMessage List     Post MessagePost Message

  How to set the border colors in graph and legend
Posted by Erwin Cabral on Oct-24-2012 04:45
Attachments:
I tried setting the border colors (black color) in graph using the setPlotArea but it is not working.
Below is my code.
-------
                w_XYChart_p = new XYChart( w_Rect.Width(), w_Rect.Height() ) ;
                if( w_XYChart_p ){
                    w_XYChart_p->setPlotArea( 10, 10,
                    w_Rect.Width()-10, w_Rect.Height()-10,
                    p_ColorList_p->m_DeskColor, -1,
                    p_ColorList_p->m_GraphForeColor,
                    p_ColorList_p->m_GraphForeColor,
                    p_ColorList_p->m_GraphForeColor ) ;
                } // if
-------

Also, may I know how to set the border colors (black color) in the legend?
ChartDir00.png

  Re: How to set the border colors in graph and legend
Posted by Peter Kwan on Oct-25-2012 00:50
Hi Erwin,

For the plot area border, your code should have already configured it to m_GraphForeColor.

However, your actual chart does not reflect the plot area configuration. For example, in your code, the plot area should have 10 pixels margin at the top and left sides. However, in your attached image, the plot area has a much larger left and top margins. Is it possible you have another line of code that also calls setPlotArea, and it sets the edge color to black (or leave it as the default value, which is black)? The PlotArea.setBackground API can also affect the edge color. Are you using this API a line in your code?

Another possibility is that the black color you see is the color of the axis. I see that the "tick" color is red in your chart, so you may have use Axis.setColors to configure the axis color. Have you set the axis color to red as well?

If the above still cannot solve the problem, is it possible to inform me the complete charting part of your code? If you cannot post the code in the forum, you may email me at pkwan@advsofteng.net. Because many APIs can affect the plot area border, I may need the complete charting code to try to reproduce the problem.

For the legend box, you may use Box.setBackground to configure the border color. The sample code "Multi-Symbol Line Chart" demonstrates how to do this (you may look up "Multi-Symbol Line Chart" from the ChartDirector documentation index). The code is like:

    LegendBox *legendBox = c->addLegend(....);
    legendBox->setBackground(Chart::Transparent, 0x445566);

Hope this can help.

Regards
Peter Kwan