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
645
Create mulitple GraphPanes in the WebChart
posted

Hi,

My company just recently purchase infragistic tool.

I am using igchart:UltraChart to create a graph

Is there a way to create mulitple graph panes (different graph) in the Master Pane.

I want to create different ration for each panl, Can I do that.

I want to create the X-axis as date.

Could you please point me to some example.

Thanks

Parents
  • 3255
    Suggested Answer
    posted

    Hi TedNguyen

    I guess you want to create a composite chart, if that is the case please take a look at this page: http://help.infragistics.com/NetAdvantage/ASPNET/2010.3/CLR4.0/?page=Chart_Creating_a_Composite_Chart.html. It describes different ways for creating such charts.

    For X-axis as date you can read more from this article: http://help.infragistics.com/NetAdvantage/ASPNET/2010.3/CLR4.0/?page=Chart_Display_Data_on_a_Time_Scale_Axis.html

    Regards,

    Ivan Kotev

  • 645
    posted in reply to [Infragistics] Ivan Kotev

    Thanks, Ivan

    I want to create something this

     

    The Value 1 and 2 is one graph, the value 3 and line is another graph, all of them in one image

  • 3255
    posted in reply to Tung

    Hi TedNguyen,

    Please take a look at this page for the list of 2D chart that you can create: http://samples.infragistics.com/2010.3/WebFeatureBrowser/contents.aspx?showCode=true&t=WebCharts/Gallery/TwoDChartGallery.aspx~srcview.aspx?path=../WebFeatureBrowserVB/WebCharts/Gallery/TwoDChartGallery.src~srcview.aspx?path=WebCharts/Gallery/TwoDChartGallery.src

    For Value 1 you can use the Gantt chart, for value 3 - take a look at theLine and Spline charts category.

    You can set ChartArea's position through chartAres's Bounds and BoundMeasureType properties.

    Please let me know if you have further questions.

     

    Ivan Kotev

  • 3255
    Suggested Answer
    posted in reply to Tung

    Hi Ted,

    I have used the code snippets from this tutorial http://help.infragistics.com/NetAdvantage/ASPNET/2010.3/CLR4.0/?page=Chart_Creating_a_Composite_Chart_in_Code_Part_1_of_2.html and http://help.infragistics.com/NetAdvantage/ASPNET/2010.3/CLR4.0/?page=Chart_Creating_a_Composite_Chart_in_Code_Part_2_of_2.html

    to build the following sample:

                ultrachart1.ChartType = ChartType.Composite;

                ChartArea myChartArea = new ChartArea();
                myChartArea.Bounds = new Rectangle(0, 0, 100, 50);
                myChartArea.BoundsMeasureType = MeasureType.Percentage;           

                ultrachart1.CompositeChart.ChartAreas.Add(myChartArea);

                AxisItem axisX = new AxisItem();
                axisX.OrientationType = AxisNumber.X_Axis;
                axisX.DataType = AxisDataType.String;
                axisX.SetLabelAxisType = SetLabelAxisType.GroupBySeries;
                axisX.Labels.ItemFormatString = "<ITEM_LABEL>";
                axisX.Labels.Orientation = TextOrientation.VerticalLeftFacing;

                AxisItem axisY = new AxisItem();
                axisY.OrientationType = AxisNumber.Y_Axis;
                axisY.DataType = AxisDataType.Numeric;
                axisY.Labels.ItemFormatString = "<DATA_VALUE:0.#>";

                myChartArea.Axes.Add(axisX);
                myChartArea.Axes.Add(axisY);

                NumericSeries seriesA = GetNumericSeriesBound();
                NumericSeries seriesB = GetNumericSeriesUnBound();
                ultrachart1.CompositeChart.Series.Add(seriesA);
                ultrachart1.CompositeChart.Series.Add(seriesB);

                ChartLayerAppearance myColumnLayer = new ChartLayerAppearance();
                myColumnLayer.ChartType = ChartType.ColumnChart;
                myColumnLayer.ChartArea = myChartArea;
                myColumnLayer.AxisX = axisX;
                myColumnLayer.AxisY = axisY;
                myColumnLayer.Series.Add(seriesA);
                myColumnLayer.Series.Add(seriesB);
                ultrachart1.CompositeChart.ChartLayers.Add(myColumnLayer);

                //chart 2

                ChartArea myChartArea2 = new ChartArea();
                myChartArea2.Bounds = new Rectangle(0,50, 100, 50);
                myChartArea2.BoundsMeasureType = MeasureType.Percentage;
               
                ultrachart1.CompositeChart.ChartAreas.Add(myChartArea2);           

                AxisItem axisX2 = new AxisItem();
                axisX2.OrientationType = AxisNumber.X_Axis;
                axisX2.DataType = AxisDataType.Numeric;
                axisX2.Labels.ItemFormatString = "<DATA_VALUE:##.##>";           
                axisX2.Extent = 30;           

                myChartArea2.Axes.Add(axisX2);
                myChartArea2.Axes.Add(axisY);           

                XYSeries seriesC = GetXYSeriesBound();
                XYSeries seriesD = GetXYSeriesUnBound();
                ultrachart1.CompositeChart.Series.Add(seriesC);
                ultrachart1.CompositeChart.Series.Add(seriesD);
                // Customize the series colors.
                seriesC.PEs.Add(new PaintElement(Color.Green));
                seriesD.PEs.Add(new PaintElement(Color.Blue));

                ChartLayerAppearance myScatterLayer = new ChartLayerAppearance();
                myScatterLayer.ChartType = ChartType.ScatterChart;
                ((ScatterChartAppearance)myScatterLayer.ChartTypeAppearance).ConnectWithLines = true;
                myScatterLayer.ChartArea = myChartArea2;
                myScatterLayer.AxisX = axisX2;           
                myScatterLayer.AxisY = axisY;
                myScatterLayer.Series.Add(seriesC);
                myScatterLayer.Series.Add(seriesD);
                ultrachart1.CompositeChart.ChartLayers.Add(myScatterLayer);

    And the following helper methods:

     private static XYSeries GetXYSeriesBound()
     {
      XYSeries series = new XYSeries();
      series.Label = "Series C";
      // this code populates the series from an external data source
      DataTable table = GetData();
      series.Data.DataSource = table;
      series.Data.LabelColumn = "Label Column";
      series.Data.ValueXColumn = "Value Column";
      series.Data.ValueYColumn = "Another Value Column";
      return series;
     }

     private static XYSeries GetXYSeriesUnBound()
     {
      XYSeries series = new XYSeries();
      series.Label = "Series D";
      // this code populates the series using unbound data
      series.Points.Add(new XYDataPoint(1.0, 1.0, "Point A", false));
      series.Points.Add(new XYDataPoint(2.0, 2.0, "Point B", false));
      series.Points.Add(new XYDataPoint(3.0, 3.0, "Point C", false));
      series.Points.Add(new XYDataPoint(4.0, 4.0, "Point D", false));
      series.Points.Add(new XYDataPoint(5.0, 5.0, "Point E", false));
      return series;
     }

     private static DataTable GetData()
     {
      DataTable table = new DataTable();
      table.Columns.Add("Label Column", typeof(string));
      table.Columns.Add("Value Column", typeof(double));
      table.Columns.Add("Another Value Column", typeof(double));
      table.Rows.Add(new object[] { "Point A", 1.0, 3.0 });
      table.Rows.Add(new object[] { "Point B", 2.0, 2.0 });
      table.Rows.Add(new object[] { "Point C", 3.0, 1.0 });
      table.Rows.Add(new object[] { "Point D", 4.0, 2.0 });
      table.Rows.Add(new object[] { "Point E", 5.0, 3.0 });
      return table;
     }


     private static NumericSeries GetNumericSeriesBound()
     {
      NumericSeries series = new NumericSeries();
      series.Label = "Series A";
      // this code populates the series from an external data source
      DataTable table = GetData();
      series.Data.DataSource = table;
      series.Data.LabelColumn = "Label Column";
      series.Data.ValueColumn = "Value Column";
      return series;
     }
     private static NumericSeries GetNumericSeriesUnBound()
     {
      NumericSeries series = new NumericSeries();
      series.Label = "Series B";
      // this code populates the series using unbound data
      series.Points.Add(new NumericDataPoint(5.0, "Point A", false));
      series.Points.Add(new NumericDataPoint(4.0, "Point B", false));
      series.Points.Add(new NumericDataPoint(3.0, "Point C", false));
      series.Points.Add(new NumericDataPoint(2.0, "Point D", false));
      series.Points.Add(new NumericDataPoint(1.0, "Point E", false));
      return series;
     }

    The result:

    Regards,

    Ivan Kotev

Reply Children
No Data