Hi,
I am atemping to add line label for each line in my scatter line chart. Since I don't use series, I use a datatable which has several columns, I swap the rows and columns to draw the line chart.. I wonder is there any way that I can set the line label? Thank you.
My code is as follows:
UltraChart1.ChartType = ChartType.ScatterLineChart;GrowthChart growth = new GrowthChart();DataTable dt1 = growth.SearchByGenderType("M", "Length");
UltraChart1.Axis.X.RangeMin = 0;UltraChart1.Axis.X.RangeMax = 40;UltraChart1.Axis.X.RangeType = AxisRangeType.Custom;
UltraChart1.Axis.Y.RangeMin = 0;UltraChart1.Axis.Y.RangeMax = 120;UltraChart1.Axis.Y.RangeType = AxisRangeType.Custom;
UltraChart1.Axis.X2.RangeMin = 0;UltraChart1.Axis.X2.RangeMax = 40;UltraChart1.Axis.X2.RangeType = AxisRangeType.Custom;
UltraChart1.Axis.Y2.RangeMin = 0;UltraChart1.Axis.Y2.RangeMax = 120;UltraChart1.Axis.Y2.RangeType = AxisRangeType.Custom;
UltraChart1.ScatterLineChart.LineData.DataSource = dt1;UltraChart1.ScatterLineChart.LineData.SwapRowsAndColumns = true;UltraChart1.ScatterLineChart.LineData.DataBind();
DataTable dt = new DataTable();dt.Columns.Add("X-Axis", typeof(decimal));dt.Columns.Add("Y-Axis", typeof(decimal));dt.Rows.Add(new object[] { 6.5, 80 });dt.Rows.Add(new object[] { 20, 90 });
UltraChart1.ScatterLineChart.ScatterData.DataSource = dt;UltraChart1.ScatterLineChart.ScatterData.DataBind();UltraChart1.ScatterLineChart.Scatter.ColumnX = 0;UltraChart1.ScatterLineChart.Scatter.ColumnY = 1;
UltraChart1.ScatterLineChart.LineData.UseRowLabelsColumn = true;UltraChart1.ScatterLineChart.LineData.RowLabelsColumn = 0;
You could modify the scene graph by the FillSceneGraph event of the chart. Here is a link describing the event and you could find in the forum a lot of samples too.
Let me know if you have further questions.
By the way, you might have to click the graph to zoom in to find the line labels truncated by screen.
Hi Petia
Thank you for your quick response. I studyed the FillSceneGraph event, but found that it is not what I want. I am trying to add label for each lines as follows:
As you can see from the pic above, the number 95,90,75,50,25,10,5 ... on each line is what I want to add to my chart. In my database, these labels are just the column name. How to do this? Thank you for your time.
Best regards,Steven