移除副轴标签 [英] Remove secondary axis label

查看:59
本文介绍了移除副轴标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我从代码中添加了graf:

Hi !

I dinamically add graf from code :

bool gridLine = true;
List<lineseries> list = new List<lineseries>();
for (int i = 0; i < SeriesCount; i++)
{
    list.Add(new LineSeries());
}
foreach (LineSeries series in list)
{
    series.IsSelectionEnabled = true;
    series.IndependentValueBinding = new System.Windows.Data.Binding("Key");
    series.DependentValueBinding = new System.Windows.Data.Binding("Value");

    LinearAxis dependentLA = new LinearAxis();
    dependentLA.Orientation = AxisOrientation.Y;
    dependentLA.Maximum = maximum;
    dependentLA.Minimum = minimum;
    dependentLA.Interval = interval;
    dependentLA.Title = axisYname;
    dependentLA.Location = AxisLocation.Left;
    if (gridLine)
    {
        dependentLA.ShowGridLines = true;
    }
    else
    {
        dependentLA.ShowGridLines = false;
    }
    series.DependentRangeAxis = dependentLA;
    gridLine = false;

    graf.Series.Add(series);
}</lineseries></lineseries>



但是它显示的图表左侧带有两个Y轴标签(如果位置"是自动的:左侧一个,右侧第二个).我尝试只用一根Y轴和2条以上的线来创建graf.
Any1可以帮助我吗?

P.S .:如果我仅定义一个LinearAxis(例如在第一个系列中),则会自动生成second,它显示带有标签和网格线的两个Y轴(看起来很糟).如果我没有定义LinearAxis很好,但是我需要设置range,max,min,..



But it shows chart with two Y axis labels on left side (if Location is auto: one on left, second on the right side). I try to create graf just with one Y axis and 2+ lines.
Any1 help me ?

P.S.: If i define just one LinearAxis (for example in first series), second is generated automatically and it shows two axis Y with labels and with gridlines (it looks terrible). If I define no LinearAxis its good, but i need set range,max,min,..

推荐答案

最后我找到了解决方案.

Finally I have found solution.

{
List<lineseries> list = new List<lineseries>();
for (int i = 0; i < SeriesCount; i++)
{
    list.Add(new LineSeries());
}
LinearAxis dependentLA = new LinearAxis();
dependentLA.Orientation = AxisOrientation.Y;
dependentLA.Maximum = maximum;
dependentLA.Minimum = minimum;
dependentLA.Interval = interval;
dependentLA.Title = axisYname;
dependentLA.Location = AxisLocation.Left;
dependentLA.ShowGridLines=true;

CategoryAxis independentLA = new CategoryAxis();
independentLA.Orientation = AxisOrientation.X;
independentLA.Location = AxisLocation.Bottom;
independentLA.Title = axisXname;

graf.Axes.Add(dependentLA);
graf.Axes.Add(independentLA);


foreach (LineSeries series in list)
{
    series.IsSelectionEnabled = true;
    series.IndependentValueBinding = new System.Windows.Data.Binding("Key");
    series.DependentValueBinding = new System.Windows.Data.Binding("Value");

    graf.Series.Add(series);
}

}</lineseries></lineseries>


这篇关于移除副轴标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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