The problem of the following nature: there is a Chart with a large set of points, it is necessary to draw a graph. Chart height can be as much as 2-3 thousand units. After loading points into the Chart, an additional field is added along the OY axis. I set the position property to ChartArea as Height = 100 and Widht = 100, i.e. thus, the schedule should have stretched to the whole Chart, but for some reason the field is still there for some reason. From the Chart, I needed to remove the visibility of the axes lines and the origin should start from the upper left corner (made AxisY.IsReversed = true). So how to remove these "snot"?

enter image description here

  • Something is doubtful to me that the explicit indication of Height = 100 and Widht = 100 leads to stretching to the entire accessible area ... Is it a WPF or WinForm? A chart from standard controls or a plug-in library? - Alexey
  • @Alexey WinForms, Standard Chart - Naf
  • Created a test project. I threw on the form Chart (System.Windows.Forms.DataVisualization.Charting.Chart). I created a test method, copied your code there, the compiler swears to me at the event chart.ChangingScale and all the properties of the chart that you refer to in the code, says Chart has no such. Those. this is either not a standard chart, or I forgot to connect any of them ... - Alexey
  • The @Alexey parameter specified in the constructor is an object of my own class that contains graph points. all that is connected with it in the code can be removed and filled with any points. The constructor is contained in a class: public sealed class _2DChart: Chart. - Naf
  • @Alexey has rephrased the question a bit, I apologize for the ambiguity. - Naf

1 answer 1

The method of scientific spear found a property in Axis'ov which is responsible for displaying the dashes to which the numbers are joined ...

In general, if you set it to false then the lines will disappear:

area.AxisY.MajorTickMark.Enabled = false; area.AxisX.MajorTickMark.Enabled = false; 

And to remove the indents at the edges, do the following (by analogy with the Position): area.InnerPlotPosition= new ElementPosition(0, 0, 100, 100);

  • c-c-c. this way the lines will disappear, but the indent will remain. I need to remove this indent from the top, which is highlighted in red in the picture. - Naf
  • @ Nafisa updated the answer. - Alexey