We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Chart XValues YValues of a 2dim chart XLSio Scatter line type

I can not fill in the values in the series that covers the Xvalues and Yvalues fora ScattetLine Graph:

IChartSerie serie = chart.Series.Add(ExcelChartType.Scatter_Line);

serie.UsePrimaryAxis = false;
serie.Name = "SomeName";

serie.Values = atrExcel.Range[r_start1.Row, r_start1.Column,r_start2.Row-1,r_end2.Column];


excelXvalues.zip

8 Replies

CP Chella Pandian B Syncfusion Team December 1, 2006 06:12 PM UTC

Hi Werner Plumot

I have solved the problem please check the sample and let me know any other modifications.

Sample:
ScattetLine.zip

Thanks for using XlsIO.

With regards,
Chella.


WP Werner Plumot December 4, 2006 08:18 AM UTC

Thank you !

>Hi Werner Plumot

I have solved the problem please check the sample and let me know any other modifications.

Sample:
ScattetLine.zip

Thanks for using XlsIO.

With regards,
Chella.


WP Werner Plumot December 4, 2006 08:34 AM UTC

I get the problem at run time than the name "Austin" in your example already exists.
I have two graphics in youre example, I just need one with the Xaxis values and the YAxisValues. As you can see in my picture. It is for me impossible ti fill in the XValues, no problem for the YValues.

>Hi Werner Plumot

I have solved the problem please check the sample and let me know any other modifications.

Sample:
ScattetLine.zip

Thanks for using XlsIO.

With regards,
Chella.


excel2ex.zip


CP Chella Pandian B Syncfusion Team December 5, 2006 12:15 AM UTC

Hi Werner Plumot

I have found the way for inserting value to the X-axis. Please check the Sample too.

// Setting value for Y-axis;
IChartSerie serie1 = chart.Series[0];
serie1.Name = "Austin";
serie1.Values = sheet.Range[1,1,2,1];

// creating serie1
IChartSerie serie2 = chart.Series[1];
serie2.Name = "Ramco";
serie2.Values = sheet.Range[1,3,2,3];

//chart.IsSeriesInRows = false;

// Setting value for X-axis;
chart.Series[0].CategoryLabels = sheet.Range[1,2,2,2];
chart.Series[1].CategoryLabels = sheet.Range[1,4,2,4];

Let me know any other difficulties.

Sample:

ScattetLine.zip


With regards,
Chella.



WP Werner Plumot December 5, 2006 12:24 PM UTC

THANK YOU, that did it.... I spend some time on it and I could not find it...
The code below makes realy values for the X and Y axis. You need to remove the first datarange like in Excel. Great !

chart.ChartType = ExcelChartType.Scatter_Line;
chart.IsSeriesInRows = true;
// Assigning values to the chart
chart.DataRange = sheet.Range[1,1,2,4];

// Naming X - Axis
chart.PrimaryCategoryAxis.Title = "City";

// Naming Y - Axis
chart.PrimaryValueAxis.Title = "Sales (in Dollars)";

// Chart title
chart.ChartTitle = "Texas Books Unit Sales";

// setting value for Y-axis;
// creating serie1
IChartSerie serie1 = chart.Series[0];
serie1.Name = "Austin";
serie1.Values = sheet.Range[1,1,1,4];
chart.Series[0].CategoryLabels = sheet.Range[2,1,2,4];

chart.Series.RemoveAt(1);

serie1.Name = "Austin";
serie1.Values = sheet.Range[1,1,1,4];
chart.Series[0].CategoryLabels = sheet.Range[2,1,2,4];


WP Werner Plumot December 5, 2006 12:51 PM UTC

all : this is better :


IWorksheet sheet = workbook.Worksheets[0];

// Inserting value to sheet.

sheet.Range[1,1].Value = "15";
sheet.Range[1,2].Value = "35";
sheet.Range[1,3].Value = "70";
sheet.Range[1,4].Value = "90";

sheet.Range[2,1].Value = "10";
sheet.Range[2,2].Value = "20";
sheet.Range[2,3].Value = "30";
sheet.Range[2,4].Value = "70";

sheet.Range[3, 1].Value = "5";
sheet.Range[3, 2].Value = "60";
sheet.Range[3, 3].Value = "70";
sheet.Range[3, 4].Value = "80";

sheet.Range[4, 1].Value = "10";
sheet.Range[4, 2].Value = "50";
sheet.Range[4, 3].Value = "60";
sheet.Range[4, 4].Value = "80";


// adding chart
IChartShape chart= sheet.Charts.Add();

// XlsIO Support more that 70 different types of charts.
chart.ChartType = ExcelChartType.Scatter_Line;
chart.IsSeriesInRows = true;
// Naming X - Axis
chart.PrimaryCategoryAxis.Title = "City";

// Naming Y - Axis
chart.PrimaryValueAxis.Title = "Sales (in Dollars)";

// Chart title
chart.ChartTitle = "Texas Books Unit Sales";

IChartSerie serie1 = chart.Series.Add("Austin");
serie1.Values = sheet.Range[2, 1, 2, 4];
chart.Series[0].CategoryLabels = sheet.Range[1, 1, 1, 4];

IChartSerie serie2 = chart.Series.Add("Jef");
serie2.Values = sheet.Range[4, 1, 4, 4];
chart.Series[1].CategoryLabels = sheet.Range[3, 1, 3, 4];


CP Chella Pandian B Syncfusion Team December 5, 2006 11:01 PM UTC

Hi Werner Plumot,

Thank for the information. Please let me know any other difficulties.

Thanks for your interest in XlsIO.

With regards,
Chella.


SK Sujeet Kumar Suman replied to Chella Pandian B April 4, 2018 10:43 AM UTC

Hi Werner Plumot,

Thank for the information. Please let me know any other difficulties.

Thanks for your interest in XlsIO.

With regards,
Chella.

Yes.

Loader.
Live Chat Icon For mobile
Up arrow icon