0
votes

I've just started to evaluate TeeChart MonoDroid version and have some minor issues from the following code:

TChart _Chart = new TChart(context);
Bar _Bar1 = new Bar(_Chart.Chart);
Bar _Bar2 = new Bar(_Chart.Chart);

_Chart.Axes.Left.Increment = 25;
_Chart.Axes.Left.SetMinMax(0, 100);
_Chart.Axes.Left.Labels.Style = AxisLabelStyle.Mark;
_Chart.Axes.Visible = false;
_Chart.Walls.Left.Visible = false;
_Chart.Panel.Gradient.Visible = false;
_Chart.Panel.Transparent = true;
_Chart.Walls.Back.Color = System.Drawing.Color.White;
_Chart.Walls.Back.Width = 200;
_Chart.Walls.Back.Transparency = 90;
_Chart.Walls.Back.Gradient.Visible = false;
_Chart.Walls.Bottom.Size = 10;
_Chart.Walls.Bottom.Width = 200;
_Chart.Legend.Visible = false;
_Chart.Header.Visible = false;
_Chart.Aspect.View3D = true;
_Chart.SetBackgroundColor(Color.Transparent);

_Bar1.Add(50, "50%");
_Bar1.Depth = 10;
_Bar1.Pen.Color = System.Drawing.Color.Red;
_Bar1.Color = System.Drawing.Color.Red;
_Bar1.MarksOnBar = true;
_Bar1.MultiBar = MultiBars.Stacked;
_Bar1.Marks.Style = MarksStyles.Label;
_Bar1.Marks.Transparent = true;
_Bar1.Marks.Font.Color = System.Drawing.Color.White;
_Bar1.Marks.Font.Size = 18;
_Bar1.Marks.Font.Bold = true;
_Bar1.CustomBarWidth = 75;
_Bar1.MarksLocation = MarksLocation.Center;

_Chart.Series.Add(_Bar1);

_Bar2.Add(50, "50%");
_Bar2.Depth = 10;
_Bar2.Pen.Color = System.Drawing.Color.Black;
_Bar2.Color = System.Drawing.Color.Black;
_Bar2.MarksOnBar = true;
_Bar2.MultiBar = MultiBars.Stacked;
_Bar2.Marks.Style = MarksStyles.Label;
_Bar2.Marks.Transparent = true;
_Bar2.Marks.Font.Color = System.Drawing.Color.White;
_Bar2.Marks.Font.Size = 18;
_Bar2.Marks.Font.Bold = true;
_Bar2.CustomBarWidth = 75;
_Bar2.MarksLocation = MarksLocation.Center;

_Chart.Series.Add(_Bar2);

AbsoluteLayout absl = new AbsoluteLayout(this);

absl.SetBackgroundColor(Color.Transparent);

absl.AddView(_Chart, new AbsoluteLayout.LayoutParams(400, 1200, 0, 0));

This produces a stacked single bar, 50% split between red and black. My issues are as follows:

1) No matter what I try, I can't get the View to be transparent - I'd like any underlying View to show through the Chart.

2) I can't seem to make the bottom "wall" any deeper - I'd like it to be as deep as the bar depth.

I am also experiencing a "flashing" issue when I attempt to update the chart using the following code:

_Chart.Series[0].Clear();
_Chart.Series[1].Clear();

_Bar1.Add(HistoryRed, String.Format("{0:0,0.00}%", HistoryRed));
_Bar1.Depth = 10;
_Bar1.Pen.Color = System.Drawing.Color.Red;
_Bar1.Color = System.Drawing.Color.Red;
_Bar1.MarksOnBar = true;
_Bar1.MultiBar = MultiBars.Stacked;
_Bar1.Marks.Style = MarksStyles.Label;
_Bar1.Marks.Transparent = true;
_Bar1.Marks.Font.Color = System.Drawing.Color.White;
_Bar1.Marks.Font.Size = 18;
_Bar1.Marks.Font.Bold = true;
_Bar1.CustomBarWidth = 75;
_Bar1.MarksLocation = MarksLocation.Center;

_Chart.Series[0].Add(_Bar1);

_Bar2.Add(HistoryBlack, String.Format("{0:0,0.00}%", HistoryBlack));        
_Bar2.Depth = 10;
_Bar2.Pen.Color = System.Drawing.Color.Black;
_Bar2.Color = System.Drawing.Color.Black;
_Bar2.MarksOnBar = true;
_Bar2.MultiBar = MultiBars.Stacked;
_Bar2.Marks.Style = MarksStyles.Label;
_Bar2.Marks.Transparent = true;
_Bar2.Marks.Font.Color = System.Drawing.Color.White;
_Bar2.Marks.Font.Size = 18;
_Bar2.Marks.Font.Bold = true;
_Bar2.CustomBarWidth = 75;
_Bar2.MarksLocation = MarksLocation.Center;

_Chart.Series[1].Add(_Bar2);

It seems that the entire View is destroyed and re-created, which gives a brief flash as it disappears and re-appears. Is there a way to update the Chart without the flashing?

1

1 Answers

0
votes

1) No matter what I try, I can't get the View to be transparent - I'd like any underlying View to show through the Chart.

You need to set back wall to transparent too:

  _Chart.Walls.Back.Transparent = true;

2) I can't seem to make the bottom "wall" any deeper - I'd like it to be as deep as the bar depth.

You can change that with Chart3DPercent:

  _Chart.Aspect.Chart3DPercent = 25;

It seems that the entire View is destroyed and re-created, which gives a brief flash as it disappears and re-appears. Is there a way to update the Chart without the flashing?

Recently we implemented a new feature for MfA which disables both zooming and scrolling:

  _Chart.Zoom.Style = Steema.TeeChart.ZoomStyles.None;

Since no zoom or scrolling is suppported the chart can render in a more efficient way. The TeeChart Mono for Androis installer contains a real-time charting demo.