0
votes

Ok.... I have a WinForms Chart that is successfully plotting my series. HOWEVER, the X Axis numeric labels (not the Title, the "number line") do NOT display at all. I have not altered or touched anything! I have the EXACT same setup in another VSExpress project, same plot setup, and those Axis numeric labels display just fine. What the hell is going on???

** The Y Axis numbers show up just fine, with no issue. It's only the X Axis that is being like this.

* The Y axis values are Pressures values * The X Axis values are Volumes values

I have tried:

  1. Forcing the "Interval" = 1
  2. Forcing the Axis "Max" / "Min" to specific values
  3. Setting the "IntervalType"
  4. Setting the "LabelStyle"

Nothing has changed. Zero effect. There is still NO indication to the user what the values of the X Axis are displaying. There is only ONE plot, ONE chart, ONE chartArea and a single series with 3 data points. WHERE. ARE. THE. AXIS. NUMBERS!??

I was under the impression, that unless the user has tampered with something, those axis labels should just show up automatically (and then it's up to the user to format, etc.).... am I wrong about that?

Here is a snippet from the Designer:

chartArea2.AxisX.MinorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dash;
            chartArea2.AxisX.MinorTickMark.Enabled = true;
            chartArea2.AxisX.Title = "Cum. Adjusted Inventory (Mcf)";
            chartArea2.AxisX.TitleFont = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            chartArea2.AxisX.LabelStyle.Interval = 1;
            chartArea2.AxisX.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Auto;                  
            chartArea2.AxisY.MinorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dash;
            chartArea2.AxisY.MinorTickMark.Enabled = true;
            chartArea2.AxisY.Title = "Pressure (psia)";
            chartArea2.AxisY.TitleFont = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

~Sincerely frustrated, A

1
chartArea2.AxisX.LabelStyle.Interval = 1; Depending on the data this could be a problem. Can you show us an image? - TaW
How do I show you an image? There is no "attachment" link.... - Ash
When editing the answer there is an image icon at the top. If you can't get it to work you can upload it to imgur or another free upload service and post the url.. - TaW

1 Answers

0
votes

I figured out the answer to my question.

I had this code written in a .cs file:

 System.Windows.Forms.DataVisualization.Charting.Series newObservationSeries = new System.Windows.Forms.DataVisualization.Charting.Series()
            {
                ChartType = SeriesChartType.Line,
                MarkerStyle = MarkerStyle.Diamond,
                MarkerSize = 5,
                BorderWidth = 2,
                BorderDashStyle = ChartDashStyle.Dash,
                AxisLabel = "Pressure"
            };

This last line "AxisLabel = "Pressure"" was screwing up the plots ability to discern the correct Axis Labels. I simply REMOVED that line, and the labels appeared. It was from a prior attempt to create an Axis Title, before I knew how to do so. I simply forgot to remove it.
The correct code is:

 System.Windows.Forms.DataVisualization.Charting.Series newObservationSeries = new System.Windows.Forms.DataVisualization.Charting.Series()
            {
                ChartType = SeriesChartType.Line,
                MarkerStyle = MarkerStyle.Diamond,
                MarkerSize = 5,
                BorderWidth = 2,
                BorderDashStyle = ChartDashStyle.Dash
            };

Cheers!