问题
So here is my successfully generated chart. However for some reason on this chart only it decides the date times should show up at the top of the chart instead of the bottom. Here is my code and what I've tried. Notice the text is neither bold nor is at showing where it should. I've also tried giving the chart a ton of area to work with and it still does this. Any help in the right direction would be greatly appreciated.
ExcelChart paintDewChart = overview.Drawings.AddChart(w.Name + "Dew", OfficeOpenXml.Drawing.Chart.eChartType.LineMarkersStacked);
paintDewChart.Title.Text = "Paint Dew";
paintDewChart.SetPosition(24, 0, 0, 0);
paintDewChart.SetSize(1550, 400);
paintDewChart.Legend.Position = eLegendPosition.Bottom;
var dser1 = (ExcelLineChartSerie)(paintDewChart.Series.Add(w2.Cells["C4:C" + water.Count.ToString()], w1.Cells["A4:A" + water.Count.ToString()]));
var dser2 = (ExcelLineChartSerie)(paintDewChart.Series.Add(w2.Cells["D4:D" + water.Count.ToString()], w1.Cells["A4:A" + water.Count.ToString()]));
dser1.Header = "PC2 Dew";
dser2.Header = "B Dew";
dser1.DataLabel.Position = eLabelPosition.Bottom;
dser2.DataLabel.Position = eLabelPosition.Bottom;
dser1.DataLabel.Font.Bold = true;
dser2.DataLabel.Font.Bold = true;
EDIT:
I figured out I can flip the orientation with this, however labels still overlay on the graph instead of below it.
paintDewChart.YAxis.Orientation = eAxisOrientation.MaxMin;
回答1:
Here is the correct code I need for my situation.
paintDewChart.YAxis.Orientation = eAxisOrientation.MaxMin;
paintDewChart.XAxis.LabelPosition = eTickLabelPosition.High;
paintDewChart.XAxis.TickLabelPosition = eTickLabelPosition.High;
EDIT: Also depending on minimum and maximum value ranges going from positive to negative, you may need this.
paintDewChart.XAxis.Crosses = eCrosses.Max;
来源:https://stackoverflow.com/questions/41576082/how-to-change-data-label-position-in-epplus