我在T恤图表中有2个系列。一个是介于0和100之间的百分比值,并使用左轴。另一个是温度,使用右轴,可能值的范围在-40F到160F之间。
我希望两个条形从底部轴开始。我认为该系列的UseOrigin和Origin属性可以做到这一点,但显然它不起作用。
以下是我的代码:
chartTank = new TChart();
chartTank.Axes.Left.Grid.Visible = false;
chartTank.Axes.Right.Grid.Visible = false;
chartTank.Axes.Right.Maximum = 160.0;
chartTank.Axes.Right.Minimum = -40;
chartTank.Axes.Right.Increment = 40;
chartTank.Axes.Right.Automatic = false;
chartTank.Axes.Right.AutomaticMinimum = false;
chartTank.Axes.Right.AutomaticMaximum = false;
chartTank.Aspect.View3D = false;
chartTank.Panel.Bevel.Inner = Steema.TeeChart.Drawing.BevelStyles.None;
chartTank.Panel.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None;
chartTank.Axes.Left.Grid.Visible = false;
chartTank.Axes.Bottom.GridCentered = false;
chartTank.Axes.Bottom.Ticks.Visible = false;
chartTank.Axes.Left.Automatic = false;
chartTank.Axes.Left.Minimum = 0;
chartTank.Axes.Left.Maximum = 100;
chartTank.Axes.Right.Visible = true;
var barProduct = new Steema.TeeChart.Styles.Bar();
barProduct.MultiBar = MultiBars.Stacked;
barProduct.Color = Color.Green;
barProduct.Marks.Visible = false;
barProduct.Title = "% Vol";
barProduct.ShowInLegend = true;
chartTank.Series.Add(barProduct);
var barTemperature = new Steema.TeeChart.Styles.Bar();
barTemperature.MultiBar = MultiBars.None;
barTemperature.Color = Color.FromArgb(153, 74, 11);
barTemperature.Marks.Visible = false;
barTemperature.VertAxis = VerticalAxis.Right;
barTemperature.UseOrigin = true;
barTemperature.Origin = -40;
barTemperature.Title = "Temperature";
barTemperature.ShowInLegend = true;
chartTank.Series.Add(barTemperature);
Controls.Add(chartTank);
结果如下:
我正在使用TeeChart 2014 4.1 for .NET在Windows CE 6.0上运行
答案 0 :(得分:2)
以下代码:
private void InitializeChart()
{
tChart1.Axes.Right.Grid.Visible = false;
tChart1.Axes.Right.Maximum = 160.0;
tChart1.Axes.Right.Minimum = -40;
tChart1.Axes.Right.Increment = 40;
tChart1.Axes.Right.Automatic = false;
tChart1.Axes.Right.AutomaticMinimum = false;
tChart1.Axes.Right.AutomaticMaximum = false;
tChart1.Aspect.View3D = false;
tChart1.Panel.Bevel.Inner = Steema.TeeChart.Drawing.BevelStyles.None;
tChart1.Panel.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None;
tChart1.Axes.Left.Grid.Visible = false;
tChart1.Axes.Bottom.Grid.Centered = false;
tChart1.Axes.Bottom.Ticks.Visible = false;
tChart1.Axes.Left.Automatic = false;
tChart1.Axes.Left.Minimum = 0;
tChart1.Axes.Left.Maximum = 100;
tChart1.Axes.Right.Visible = true;
var barProduct = new Steema.TeeChart.Styles.Bar();
barProduct.MultiBar = MultiBars.Side;
barProduct.Color = Color.Green;
barProduct.Marks.Visible = false;
barProduct.Title = "% Vol";
barProduct.ShowInLegend = true;
Random rnd = new Random();
for (int i = 0; i < 10; i++)
{
barProduct.Add(rnd.Next(0, 100));
}
tChart1.Series.Add(barProduct);
var barTemperature = new Steema.TeeChart.Styles.Bar();
barTemperature.MultiBar = MultiBars.Side;
barTemperature.Color = Color.FromArgb(153, 74, 11);
barTemperature.Marks.Visible = false;
barTemperature.VertAxis = VerticalAxis.Right;
barTemperature.UseOrigin = true;
barTemperature.Origin = -40;
barTemperature.Title = "Temperature";
barTemperature.ShowInLegend = true;
for (int i = 0; i < 10; i++)
{
barTemperature.Add(rnd.Next(-40, 160));
}
tChart1.Series.Add(barTemperature);
tChart1.Panel.Gradient.Visible = false;
tChart1.Walls.Back.Gradient.Visible = false;
tChart1.Panel.Color = Color.White;
tChart1.Walls.Back.Color = Color.White;
}
给我以下图表:
你最终会得到相同的结果吗?