[英]How to increase the drawing area for an Axis in Oxyplot?
我正在编写一个实用程序,通过电子邮件发送堆积的柱形图,该柱形图显示每个人的任务。 现在,我使用PngExporter
在OxyPlot.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()
将给定字符串的长度放在paddedString()
并返回。 这是我目前“翻译”标签的方法,但现在我担心要绘制其余的名称。
我已经浏览了CategoryAxis
页面,但似乎找不到扩展轴区域以完全显示名称的方法。 而且,我不希望只缩短用户名。
这在WPF应用程序中对我有用。
var currentMargins = plotModel.PlotMargins;
plotModel.PlotMargins = new OxyThickness(currentMargins.Left, currentMargins.Top, currentMargins.Right, 100);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.