Page 1 of 1

Custom Axis marking the top and bottom.

Posted: Fri Oct 15, 2010 6:01 am
by 8751509
Greetings

With the custom axis is there anything in TChart I can use to mark the horizontal boundaries of say the top of the axis and the bottomof the axis ... currently I was using colorlines .. but I had to draw them programatically and the constantly rescaling axis was makign this a nightmare ... (I add and remove custom axis like its going out of fashion)

The built in Axis have wall settings ... is there something like this for custom axes .. or anything that can mark the top and bottom of a custom axis and stay in place without me having to recalculate ..


Cheers Phil.

Re: Custom Axis marking the top and bottom.

Posted: Fri Oct 15, 2010 10:20 am
by 10050769
Hello Phil,

I have made simple example that I think you can use in your application:

Code: Select all

public Form1()
        {
            InitializeComponent();
            InitializeChart();

        }
        Steema.TeeChart.Axis axis1;
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            Steema.TeeChart.Styles.Line series1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            Steema.TeeChart.Styles.Line series2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            
            series1.FillSampleValues();
            series2.FillSampleValues();
            //Add Custom Axes.
            axis1 = new Steema.TeeChart.Axis(tChart1.Chart);
            tChart1.Axes.Custom.Add(axis1);
            series1.CustomVertAxis = tChart1.Axes.Left;
            series2.CustomVertAxis = axis1;
            tChart1.Axes.Left.StartPosition = 50;
            tChart1.Axes.Left.EndPosition = 100;

            axis1.StartPosition= 0;
            axis1.EndPosition = 50;
            axis1.AxisPen.Color = Color.Blue;

            axis1.SetMinMax(series2.YValues.Minimum,series2.YValues.Maximum);
            tChart1.Axes.Left.SetMinMax(series1.YValues.Minimum, series1.YValues.Maximum);
            tChart1.AfterDraw  = new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
        }

        void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
            int pos1 =(int) Math.Abs(tChart1.Axes.Left.StartPosition - axis1.StartPosition);
            g.HorizontalLine(pos1,(int) tChart1.Axes.Bottom.CalcXPosValue(tChart1.Axes.Bottom.Maximum),axis1.CalcYPosValue(axis1.Minimum));
        }
Could you please, tell us if previous code works fine for you?

I hope will helps.

Thanks,

Re: Custom Axis marking the top and bottom.

Posted: Fri Oct 22, 2010 6:28 am
by 8751509
Thanks Sandra,

that worked pretty well ...