How do I set the width of the bars in an Oxyplot column plot?

六月ゝ 毕业季﹏ 提交于 2020-01-06 11:46:58

问题


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>

回答1:


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;
}


来源:https://stackoverflow.com/questions/50453469/how-do-i-set-the-width-of-the-bars-in-an-oxyplot-column-plot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!