c#chart epplus axis reverse order

时间:2017-06-22 14:16:57

标签: charts reverse epplus

我在Excel中导出并使用Epplus绘制图表:

var chart = (ExcelChart)wksh.Drawings.AddChart("Chart", eChartType.Line);
chart.SetSize(500, 300);
chart.SetPosition(5, 800);
chart.Title.Text = "myChart";
chart.Series.Add(ExcelRange.GetAddress(2, 26, rowIndex, 26), ExcelRange.GetAddress(2, 25, rowIndex, 25));

默认情况下从左到右获取图表:

enter image description here

如何从右到左获取图表?

enter image description here

例如,在属性中的Excel中,有一个参数“按相反顺序排列”:

如何在Epplus中完成?

1 个答案:

答案 0 :(得分:3)

我有一个类似的问题,我想翻转我的y轴,我用

修复
chart.YAxis.Orientation = eAxisOrientation.MaxMin;

如果你想做x,那么同样的事情(但用x)应该有效

chart.XAxis.Orientation = eAxisOrientation.MaxMin;

您可能还想设置

chart.XAxis.MinValue 
chart.XAxis.MaxValue 
chart.XAxis.Crosses

如果您的格式看起来很糟糕