2014-06-05 43 views
0

我在發球臺有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); 

下面是結果: enter image description here

我使用的TeeChart 2014 4.1 .NET運行在Windows CE 6.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; 
} 

給我下面的字符T:

enter image description here

你得到你結束了相同的結果?

相關問題