【问题标题】:Xamarin Forms Teechart - show only graph and labelsXamarin Forms Teechart - 仅显示图形和标签
【发布时间】:2015-08-03 13:52:37
【问题描述】:

我有一个名为 tChart1 的 steema teechart,由蜡烛组成。我只想显示蜡烛和底轴的标签。其他一切都应该是透明的。我已经能够隐藏一些东西,但背景仍然是白色的,并且仍然显示垂直线(我假设网格)。

tChart1.Title.Visible = false;
tChart1.Walls.Visible = false;
tChart1.Axes.Left.Visible = false;
tChart1.Legend.Visible = false;

【问题讨论】:

    标签: xamarin xamarin.forms teechart


    【解决方案1】:

    您需要隐藏或使以下元素透明:

      tChart1.Axes.Left.Grid.Visible = false;
      tChart1.Axes.Bottom.Grid.Visible = false;
    
      tChart1.Panel.Transparent = true;
      tChart1.Panel.Gradient.Visible = false;
    
      tChart1.Walls.Visible = false;
      tChart1.Legend.Transparent = true;
    

    底轴标签字体颜色应该这样改变:

      tChart1.Axes.Bottom.Labels.Font.Color = Color.Blue;
    

    自定义标签可以这样设置:

    private void AddCustomLabels()
    {
      tChart1.Axes.Left.Labels.Items.Clear();
    
      (tChart1.Axes.Left.Labels.Items.Add(123,"Hello")).Font.Size=16;
      (tChart1.Axes.Left.Labels.Items.Add(466,"Good\n\rbye")).Transparent=false;
      tChart1.Axes.Left.Labels.Items.Add(300);
      AxisLabelItem a = tChart1.Axes.Left.Labels.Items.Add(-100);
      a.Transparent=false;
      a.Color=Color.Blue;
      a.Transparency=50;
    }
    

    蜡烛系列笔:

      candle1.Pen.Color = Color.Lime;
    

    【讨论】:

    • 谢谢!两个后续问题:如何更改底部轴上标签的颜色以及如何更改蜡烛的颜色(不是向上或向下,而是穿过蜡烛的线)?
    • 标签颜色部分不适用于我。是否通过循环手动添加标签是否重要?
    • @IliaStoilov 他们是自定义标签吗?我还使用自定义标签设置扩展了我的回复。
    • 您的代码在测试项目中有效,但在实际项目中无效。我让它与a.Font.Color = Color.White;一起工作。谢谢你的帮助,你真的救了我!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-15
    • 2020-02-25
    • 1970-01-01
    相关资源
    最近更新 更多