Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
909
Scrollbar in composite chart
posted

I have a composite chart with 2 steplines chart. I would like to add a scrollbar. Is it posiible to di that?

Here is my Code :

            Random r = new Random();

            DataTable table1 = new DataTable();

            DataTable table2 = new DataTable();

 

            table1.Columns.Add("col1", typeof(DateTime));

            table1.Columns.Add("col2", typeof(double));

 

            table2.Columns.Add("col1", typeof(DateTime));

            table2.Columns.Add("col2", typeof(double));

 

            for (int i = 0; i < 25; i++)

            {

                table1.Rows.Add(new object[] { DateTime.Now.AddMinutes(i), r.Next(10, 200) });

            }

 

            for (int i = 0; i < 55; i++)

            {

                table2.Rows.Add(new object[] { DateTime.Now.AddMinutes(i), r.Next(10, 500) });

            }

 

 

 

 

            this.UltraChart1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.Composite;

 

            ChartArea myChartArea = new ChartArea();

            this.UltraChart1.CompositeChart.ChartAreas.Add(myChartArea);

 

 

 

            AxisItem xAxis = new AxisItem(UltraChart1, AxisNumber.X_Axis);

            xAxis.DataType = AxisDataType.Time;

            xAxis.Labels.ItemFormat = AxisItemLabelFormat.ItemLabel;

            xAxis.Labels.Orientation = TextOrientation.VerticalLeftFacing;

            xAxis.Extent = 140;

            xAxis.LineColor = Color.DodgerBlue;

            xAxis.LineEndCapStyle = LineCapStyle.DiamondAnchor;

            xAxis.LineThickness = 4;

            xAxis.Labels.ItemFormatString = "<ITEM_LABEL:dd, yyyy,mm:ss>";

           

            myChartArea.Axes.Add(xAxis);

 

            AxisItem yAxis = new AxisItem(UltraChart1, AxisNumber.Y_Axis);

            yAxis.DataType = AxisDataType.Numeric;

            yAxis.Labels.ItemFormat = AxisItemLabelFormat.DataValue;

            yAxis.Extent = 40;

            yAxis.LineColor = Color.RoyalBlue;

            yAxis.LineEndCapStyle = LineCapStyle.DiamondAnchor;

            yAxis.LineThickness = 4;

            yAxis.Labels.ItemFormatString = "<DATA_VALUE:##.##>";

 

            //scroll not work.....

            /*ScrollScaleAppearance scaleAppearance = this.UltraChart1.CompositeChart.ChartAreas[0].Axes[0].ScrollScale;

            scaleAppearance.Visible = true;

            scaleAppearance.Scale = 0.2;*/

 

 

 

            myChartArea.Axes.Add(yAxis);

 

 

            Color c;

 

            NumericTimeSeries seriesArea1 = new NumericTimeSeries();

            seriesArea1.Data.DataSource = table1;

            seriesArea1.Data.TimeValueColumn = "col1";

            seriesArea1.Data.ValueColumn = "col2";

            PaintElement pe1 = new PaintElement();

            PaintElement pe2 = new PaintElement(System.Drawing.Color.Red);

            pe1.Fill = Color.Green;

            pe1.FillOpacity = 90;

           

            seriesArea1.PEs.Add(pe1);

            UltraChart1.CompositeChart.Series.Add(seriesArea1);

 

            NumericTimeSeries seriesArea2 = new NumericTimeSeries();

            seriesArea2.Data.DataSource = table2;

            seriesArea2.Data.TimeValueColumn = "col1";

            seriesArea2.Data.ValueColumn = "col2";

            PaintElement pe = new PaintElement(System.Drawing.Color.Blue);

            seriesArea2.PEs.Add(pe);

           

            UltraChart1.CompositeChart.Series.Add(seriesArea2);

 

 

            ChartLayerAppearance stepAreaLayer = new ChartLayerAppearance();

            stepAreaLayer.AxisX = xAxis;

            stepAreaLayer.AxisY = yAxis;

            stepAreaLayer.ChartArea = myChartArea;

            stepAreaLayer.ChartType = ChartType.StepLineChart;

            stepAreaLayer.Series.Add(seriesArea1);

            stepAreaLayer.Series.Add(seriesArea2);

            UltraChart1.CompositeChart.ChartLayers.Add(stepAreaLayer);

 

Thank you for your help.