我刚刚开始评估 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)无论我尝试什么,我都无法让视图变得透明 - 我希望任何基础视图都能通过图表显示。
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);
似乎整个视图被破坏并重新创建,当它消失和重新出现时,它会短暂闪烁。有没有办法在不闪烁的情况下更新图表?