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
380
How to add line label in scatter line chart?
posted

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;

Parents Reply Children
No Data