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
627
Chart is not displayed
posted

Hi,

I created a composite chart and started populating it with the column chart (I'll add the other line chart when I'll see that the column chart presented fine). The problem is that although the code completed with no exception, chart is empty and nothing is presented.

Following is the code I wrote, I guess I missed something. Please advice:

 

DataTable dt;

dt = DBQueries.getEntityAvailabilityTrendPerCEID(CEID);

this.EntityAvailabilityTrendUltraChart.ChartType = ChartType.Composite;

ChartArea area = new ChartArea();

this.EntityAvailabilityTrendUltraChart.CompositeChart.ChartAreas.Add(area);

AxisItem xAxisColumn = new AxisItem(this.EntityAvailabilityTrendUltraChart, AxisNumber.X_Axis);

AxisItem yAxis = new AxisItem(this.EntityAvailabilityTrendUltraChart, AxisNumber.Y_Axis);

yAxis.RangeType = AxisRangeType.Custom;xAxisColumn.DataType = AxisDataType.String;

xAxisColumn.SetLabelAxisType = SetLabelAxisType.GroupBySeries;

xAxisColumn.Labels.ItemFormat = AxisItemLabelFormat.ItemLabel;

yAxis.DataType = AxisDataType.Numeric;yAxis.Labels.ItemFormat = AxisItemLabelFormat.DataValue;

area.Axes.Add(xAxisColumn);

area.Axes.Add(yAxis);

 

foreach(DataRow dr in dt.Rows)

{

NumericSeries series = new NumericSeries();foreach (DataColumn dc in dt.Columns)

{

if (!dc.Caption.Equals("Entity"))

{

// adding a new point

NumericDataPoint point = new NumericDataPoint((double)dr[dc], null, false);

series.Points.Add(point);

}

}

this.EntityAvailabilityTrendUltraChart.Series.Add(series);

}

this.EntityAvailabilityTrendUltraChart.Series.AddRange(this.EntityAvailabilityTrendUltraChart.Series.ToArray());

 

ChartLayerAppearance columnLayer = new ChartLayerAppearance();

columnLayer.AxisX = xAxisColumn;

columnLayer.AxisY = yAxis;

columnLayer.ChartArea = area;

columnLayer.ChartType =
ChartType.ColumnChart;this.EntityAvailabilityTrendUltraChart.CompositeChart.ChartLayers.Add(columnLayer);

 

Thanks

Maya

Intel

Parents
No Data
Reply
  • 26458
    Offline posted

    I think you only missed one step. You need to add the series to the column layer's series collection.
    columnLayer.Series.AddRange(this.EntityAvailabilityTrendUltraChart.Series.ToArray());

Children