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
185
ColumnLine Chart legend
posted

Hello

I created a columnLine chart

and bound it to a datatable with two columns one for the column series and the other for the line series

I used the following code to draw the line serie in a different color

        private void Chart_ChartDrawItem(object sender, ChartDrawItemEventArgs e)
        {
            if (e.Primitive is Polyline )
            {
                e.Primitive.PE.Fill = Color.Firebrick;
            }
        }

and I  used the following code to bind the data 

            chart.ColumnLineChart.ColumnData.DataSource = datatable;
            chart.ColumnLineChart.ColumnData.IncludeColumn("line", false);
            chart.ColumnLineChart.ColumnData.SwapRowsAndColumns = true;
            chart.ColumnLineChart.ColumnData.DataBind();
            chart.ColumnLineChart.LineData.DataSource = datatable;
            chart.ColumnLineChart.LineData.IncludeColumn("column", false);
            chart.ColumnLineChart.LineData.SwapRowsAndColumns = true;
            chart.ColumnLineChart.LineData.DataBind();

 

My problem is that now I now only have the column series in my legend.