我正在编写一个实用程序来通过电子邮件发送一个显示每个人任务的堆积柱形图。现在我正在使用PngExporter
inOxyPlot.WindowsForms
导出绘图,但我似乎无法弄清楚如何控制图像的下限。用户名可能很长并且会溢出,我想扩展底部轴的绘图区域,以便所有名称都可见。
这是它现在的样子
这是我到目前为止的代码
var plot = new PlotModel()
{
Title = "Mantis Report"
};
// CATEGORY AXIS CODE====================================
var categoryaxis = new CategoryAxis();
foreach (var e in employees)
categoryaxis.ActualLabels.Add(paddedString("Jebediah Kerman"));
categoryaxis.Angle = 30;
categoryaxis.AxisTickToLabelDistance = 10;
// CATEGORY AXIS CODE====================================
plot.Axes.Add(categoryaxis);
plot.Axes.Add(new LinearAxis());
var series = new ColumnSeries();
series.IsStacked = true;
int employeeindex = 0;
foreach (var employee in employees)
{
foreach (var entry in employee.Tasks)
{
series.Items.Add(new ColumnItem(entry.Value, employeeindex) { Color = colors[entry.Key] });
}
employeeindex++;
}
plot.Series.Add(series);
plot.LegendTitle = "legend";
plot.LegendPlacement = LegendPlacement.Outside;
foreach (string task in tasktypes)
{
var newseries = new ColumnSeries()
{
FillColor = colors[task]
, Title = task
};
plot.Series.Add(newseries);
}
paddedString()
在空格中添加给定字符串的长度并返回它。这是我目前“翻译”标签的方法,但现在我担心绘制名称的其余部分。
我浏览了该CategoryAxis
页面,但似乎找不到扩展轴区域的方法,以便完全显示名称。不,我不希望只是缩短用户名。