In a form,
1. Put a Chart Control.
2. Goto "InitializeComponent" menthod of the form.
this.chartControl1.PrimaryXAxis.DrawGrid = false;
this.chartControl1.PrimaryYAxis.DrawGrid = false;
4. Now the look at the chart area of the chart control, the borders around it is not there.
5. Should the "draw grid = false" make the borders invisible?.
6. Is there a way to make the borders visible while setting the drawgrid to false.
ADAdministrator Syncfusion Team August 17, 2005 10:04 AM
The "borders" you see initially are the grid lines at the ends of the chart rendering area. That''s why the borders are not displayed when the grid lines are turned off.
To get a border for the ChartArea, you can use the BorderStyle property of the ChartArea:
this.chartControl1.ChartArea.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
This border will look different as it includes the axes area also.
APAtanu PodderAugust 17, 2005 12:26 PM
Okie, but suppose i say the drawgrid of Yaxis is false, that should mean the vertical border should not be drawn and if I say drawgrid of XAxis false then horizntal border should not be drawn. And if I say drawgrid false for both of them then none of the borders should be drawn.
But the chart borders are drawn if any one may it be Xaxis or Yaxis has drawborder true,
So, I am little confused here how is the drawgrid property of YAxis draws the horizontal border (TopBorder) of the Chartarea?
And also, is it possible to draw the borders in a different color and the grids insode the chart in different color? I mean I want to have a different colored border which should not look similar to the grid line in the chart...
ADAdministrator Syncfusion Team August 18, 2005 01:45 PM
The X axis grid lines are drawn for each major tick and also for the left edge - this is on top of the Y axis line itself. Since the Gridline is a 1 pixel back line and the Y axis is also a 1 pixel back line, the difference is not visible.
Please see the image below. It shows the X axis gridlines clearly by setting a different color and thickness to them:
this.chartControl1.PrimaryXAxis.GridLineType.ForeColor = System.Drawing.Color.IndianRed;
this.chartControl1.PrimaryXAxis.GridLineType.PenType = System.Drawing.Drawing2D.PenType.PathGradient;
this.chartControl1.PrimaryXAxis.GridLineType.Width = 5F;
You can differentiate the grid lines by setting the above properties.
APAtanu PodderAugust 22, 2005 11:58 AM
Thanks for the reply,
In the example shown above, I just wanted to know, as we have mentioned the grid line color of XAxis is Red, then how the all the Right border and the top border is drawn with the same color.
And also, after setting the Xaxis grid line type, if i set the y axis grid line type to some other color, then again the top border and the right border becomes the new color.
So , how grid line type of one axis is modifying both the borders, horzontal as well as vertical?