如何在 Oxyplot 柱状图中设置条形的宽度? [英] How do I set the width of the bars in an Oxyplot column plot?

查看:78
本文介绍了如何在 Oxyplot 柱状图中设置条形的宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置列系列中条形的宽度,但是在 ColumnSeries 上设置 ColumnWidth 没有任何效果.我如何影响列的宽度?

I'm trying to set the width of the bars in my column series, but setting ColumnWidth on the ColumnSeries is having no effect. How can I influence the width of the columns?

<oxy:Plot>
    <oxy:Plot.Series>
        <oxy:ColumnSeries ColumnWidth="1000" />
    </oxy:Plot.Series>
    <oxy:Plot.Axes>
        <oxy:CategoryAxis Key="CategoryAxis" />
        <oxy:LinearAxis  />
    </oxy:Plot.Axes>
</oxy:Plot>

推荐答案

OxyPlot 源码,我们可以看到实际的条形宽度计算如下.你应该能够通过调整 GapWidthMaxWidth 来达到你想要的效果.

Looking at the OxyPlot source, we can see that the actual bar width is calculated as follows. You should be able to achieve your desired effect by tweaking GapWidth and MaxWidth.

protected override double GetActualBarWidth()
{
    var categoryAxis = this.GetCategoryAxis();
    return this.ColumnWidth / (1 + categoryAxis.GapWidth) / categoryAxis.MaxWidth;
}

这篇关于如何在 Oxyplot 柱状图中设置条形的宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆