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
25
Problem with Stacked Column & Line Composite Chart..
posted

I created a column & line composite chart.. Work so well that my boss wanted a stacked column & line composite chart as well.. I assume that the only change I needed to make was to my graph layer type but when I did I lost my dates on my X-Axis and one large stacked column (guess since no dates exsists to group by). Any thoughts or ideas of what i'm doing wrong and how to fix this..

      Thanks.. Doug

      mObjWebGraph.ChartType = ChartType.Composite;
      ChartArea myChartArea = new ChartArea();
      myChartArea.Border.Thickness = 0;
      mObjWebGraph.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>";

      AxisItem axisY = new AxisItem();
      axisY.OrientationType = AxisNumber.Y_Axis;
      axisY.DataType = AxisDataType.Numeric;
      axisY.Labels.ItemFormatString = "<DATA_VALUE:0.#>";
      axisY.Labels.ResetHorizontalAlign();
      axisY.Labels.ResetVerticalAlign();
      axisY.Labels.HorizontalAlign = StringAlignment.Near;
      axisY.Labels.VerticalAlign = StringAlignment.Near;

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

 for (Int32 i = 1; i <= GraphData.Tables[0].Columns.Count - 1; i++)
 {
  Int32 iColorIndex = Convert.ToInt32(GraphData.Tables[2].Columns[i].ColumnName.Replace("AR", ""));
  ChartLayerAppearance GrphColumnLayer = new ChartLayerAppearance();
  string colName = GraphData.Tables[0].Columns[i].ColumnName;

  NumericSeries GrphSeries = GetNumericSeriesGraph(colName);
  GrphSeries.PEs.Add(new PaintElement(System.Drawing.ColorTranslator.FromHtml(sColor[iColorIndex - 1])));

  mObjWebGraph.CompositeChart.Series.Add(GrphSeries);
  GrphColumnLayer.ChartType = ChartType.StackColumnChart; //ChartType.ColumnChart;  !! Made change here.
  GrphColumnLayer.ChartArea = myChartArea;
  GrphColumnLayer.AxisX = axisX;
  GrphColumnLayer.AxisY = axisY;
  GrphColumnLayer.Series.Add(GrphSeries);
  mObjWebGraph.CompositeChart.ChartLayers.Add(GrphColumnLayer);
 }

Parents
  • 26458
    Offline posted

    You shouldn't create a new instance of a stacked column chart for each of your series. Instead, create one stacked column chart layer and assign multiple series to it. Each series will represent a single stack. If you add multple series to the layer, you will see multple stacks. You code was creating multiple stacked layers with a single series and superimposing them on one another.

Reply Children
No Data