문제

I have an application with Chart control that dynamic updated with data via timer:

Series series;
MyObject obj...

series = new Series();
chart1.Series.Add(series);
//chart1.Legends.Add(new Legend("DifferentLegend"));
//chart1.Legends["DifferentLegend"].DockedToChartArea = "Default";
//chart1.Series["Series1"].Legend = "DifferentLegend";
//chart1.Series["Series1"].IsVisibleInLegend = true;

series.Color = Color.Blue;
series.ChartType = SeriesChartType.Line;
series.BorderWidth = 3;
chart1.Series.Add(series);
//chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.White;
//chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.White;
chart1.ChartAreas[0].AxisX.MajorGrid.LineWidth = 0;
chart1.ChartAreas[0].AxisY.MajorGrid.LineWidth = 0;
chart1.ChartAreas[0].AxisX.Maximum = 4;
chart1.ChartAreas[0].AxisX.Interval = 1;
chart1.ChartAreas[0].AxisX.IsStartedFromZero = true;
chart1.ChartAreas[0].AxisX.IntervalOffsetType = DateTimeIntervalType.Number;

Timer tick:

private void chartTimer_Tick(object sender, EventArgs e)
{
    series.Points.Add(obj.BitsPerSecond * 0.000001);
}

I want to change it style and remove the squares from the control:

enter image description here

How can I do that?

도움이 되었습니까?

해결책

Try This:

chart1.ChartAreas[0].AxisX.MajorGrid.LineWidth = 0;
chart1.ChartAreas[0].AxisX.MinorGrid.LineWidth = 0;
chart1.ChartAreas[0].AxisY.MajorGrid.LineWidth = 0;
chart1.ChartAreas[0].AxisY.MinorGrid.LineWidth = 0;

To disable X-Axis Labels from the Chart :

chart1.ChartAreas[0].AxisX.LabelStyle.Enabled = false;

다른 팁

This then?

mainChart.ChartAreas[0].AxisX.MajorGrid.Enabled = false;
mainChart.ChartAreas[0].AxisY.MajorGrid.Enabled = false;
mainChart.ChartAreas[0].AxisX.MinorGrid.Enabled = false;
mainChart.ChartAreas[0].AxisY.MinorGrid.Enabled = false;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top