Search code examples
xamarinxamarin.formsteechart

Xamarin Forms Teechart - show only graph and labels


I have a steema teechart named tChart1 consisting of candles. I want to show only the candles and the labels of the bottom axis. Everything else should be transparent. I have been able to hide some of the things, but the background is still white and there are vertical lines (I assume the grid) still showing.

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

Solution

  • You need to hide or make transparent the following elements:

      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;
    

    Bottom axis labels font color should be changed like this:

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

    Custom labels can be set like this:

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

    Candle series pen:

      candle1.Pen.Color = Color.Lime;