TeeChart MonoDroid版

时间:2012-10-11 11:13:55

标签: xamarin.android teechart

我刚刚开始评估TeeChart MonoDroid版本,并从以下代码中遇到一些小问题:

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

这会产生一个堆叠的单条,50%在红色和黑色之间分开。我的问题如下:

1)无论我尝试什么,我都无法让View变得透明 - 我希望通过图表显示任何基础视图。

2)我似乎无法让底部的“墙”更深 - 我希望它与条形深度一样深。

当我尝试使用以下代码更新图表时,我也遇到了“闪烁”问题:

_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);

似乎整个视图都被破坏并重新创建,当它消失并重新出现时会短暂闪现。有没有办法在没有闪烁的情况下更新图表?

1 个答案:

答案 0 :(得分:0)

  

1)无论我尝试什么,我都无法让视图透明 - 我会   就像通过图表显示的任何基础视图一样。

您还需要将墙壁设置为透明:

  _Chart.Walls.Back.Transparent = true;
  

2)我似乎无法让底部的“墙”更深 - 我想要它   和条形深度一样深。

您可以使用 Chart3DPercent

进行更改
  _Chart.Aspect.Chart3DPercent = 25;
  

似乎整个视图都被破坏并重新创建了   短暂闪光,因为它消失并重新出现。有办法吗?   没有闪烁更新图表?

最近我们为MfA实现了一项新功能,它禁用了缩放和滚动功能:

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

由于不支持缩放或滚动,因此图表可以以更有效的方式呈现。 TeeChart Mono for Androis安装程序包含一个实时图表演示。