1
votes

We are using TeeChart for .Net, version v2014 [24 FEB 2014] RELEASE 4.1.2014.02240-02244. Problem that we're facing is for vertically aligning stack bar series in multi-panel plot. The multi-panel plot is created using two left custom axis, as can be seen in image below. Multi-panel plot created using custom axes and line tool

Upper panel plot (i.e. Panel1) has a line tool used to have axis like look-n-feel. But note that the bottom axis is common for both panel plots.

The problem in this series drawing is that bar doesn’t look vertically aligned, even though they have common x values in series data. Here is the series data: Panel 1 Series data has four points as {(10, 0.2), (20, 0.9), (30, 0.1), (40, 0.5)} Panel 2 Series data has four points as {(10, 0.4), (20, 0.2), (30, 0.7), (40, 0.3)}

Following is source code to generate chart like above.

private void PanelPlot_Load(object sender, EventArgs e)
    {            
        //Add series            
        tChart1.Series.Add(P1_Series2);
        tChart1.Series.Add(P2_Series2);            
        tChart1.Series.Add(seriesForRightAxis);

        tChart1.Series[0].Add(10, 0.4);
        tChart1.Series[0].Add(20, 0.2);
        tChart1.Series[0].Add(30, 0.7);
        tChart1.Series[0].Add(40, 0.3);


        tChart1.Series[1].Add(10, 0.1);
        tChart1.Series[1].Add(20, 0.32);
        tChart1.Series[1].Add(30, 0.2);
        tChart1.Series[1].Add(40, 1);


        tChart1.Axes.Bottom.Minimum = 0;
        tChart1.Axes.Bottom.Maximum = 40;
        tChart1.Axes.Bottom.Increment = 10;

        //--------------------------Left axis---------------------- 
        Steema.TeeChart.Axis axis = tChart1.Axes.Left;

        axis.AxisPen.Color = Color.Gray;
        axis.StartPosition = 0;
        axis.EndPosition = 48;
        axis.Minimum = 0;
        axis.Maximum = 1;
        axis.Increment = 0.2;
        axis.Automatic = true; 

        // create custom axes
        leftCustom = new Steema.TeeChart.Axis(tChart1.Chart);
        tChart1.Axes.Custom.Add(leftCustom);
        leftCustom.AxisPen.Color = Color.Gray;
        leftCustom.StartPosition =  52;
        leftCustom.EndPosition = 100;
        leftCustom.Minimum = 0;
        leftCustom.Maximum = 1;
        leftCustom.Increment = 0.2;

        // associate series
        P1_Series1.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Left;
        P1_Series2.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Left;
        P1_Series3.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Left;

        P2_Series1.CustomVertAxis = leftCustom;
        P2_Series2.CustomVertAxis = leftCustom;
        P2_Series3.CustomVertAxis = leftCustom;


        //---------------------- Right Axies --------------------------

        seriesForRightAxis.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Right;

        Steema.TeeChart.Axis axis1 = tChart1.Axes.Right;
        axis1.AxisPen.Color = Color.Gray;
        axis1.StartPosition = 0;
        axis1.EndPosition = 100;
        axis1.Maximum = 300;
        axis1.Minimum = 0;
        axis1.Increment = 100;

        tChart1.Series[2].Add(10, 50);
        tChart1.Series[2].Add(10, 100);
        tChart1.Series[2].Add(10, 150);
        tChart1.Series[2].Add(20, 200);
        tChart1.Series[2].Add(20, 250);
        tChart1.Series[2].Transparency = 100;

        tChart1.Axes.Right.Labels.Items.Add(100, "100");
        tChart1.Axes.Right.Labels.Items.Add(200, "200");
        tChart1.Axes.Right.Labels.Items.Add(300, "300");
        tChart1.Axes.Right.Labels.Items.Add(400, "400");
        tChart1.Axes.Right.Grid.Visible = false; ;

    }

Please suggest if there exists any way to align the bars in situation like this.

Thanks in advance!

1

1 Answers

1
votes

Try setting MultiBar to MultiBars.None:

P1_Series2.MultiBar = Steema.TeeChart.Styles.MultiBars.None;
P2_Series2.MultiBar = Steema.TeeChart.Styles.MultiBars.None;