C# 如何在Oxyplot中增加轴的绘图区域?
我正在编写一个实用程序,通过电子邮件发送一个堆叠柱形图,显示每个人的任务。现在我正在使用C# 如何在Oxyplot中增加轴的绘图区域?,c#,oxyplot,C#,Oxyplot,我正在编写一个实用程序,通过电子邮件发送一个堆叠柱形图,显示每个人的任务。现在我正在使用OxyPlot.WindowsForms中的PngExporter导出绘图,但我似乎不知道如何控制图像的下限。用户名可能很长,会溢出到外部,我想扩展底部轴的绘图区域,以便所有名称都可见 这就是它现在的样子 这是我到目前为止的代码 var plot = new PlotModel() { Title = "Mantis Report" }
OxyPlot.WindowsForms
中的PngExporter
导出绘图,但我似乎不知道如何控制图像的下限。用户名可能很长,会溢出到外部,我想扩展底部轴的绘图区域,以便所有名称都可见
这就是它现在的样子
这是我到目前为止的代码
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()
在给定字符串的长度前面加上空格并返回。这是我目前“翻译”标签的方法,但现在我担心的是如何画出名称的其余部分
我已经浏览了
分类轴
页面,但似乎找不到扩展轴区域的方法,因此名称将完全显示出来。不,我不希望只是缩短用户名 这在WPF应用程序中对我很有效
var currentMargins = plotModel.PlotMargins;
plotModel.PlotMargins = new OxyThickness(currentMargins.Left, currentMargins.Top, currentMargins.Right, 100);