Scatter With Markers

I was wondering how I would be able to edit a ScatterWithMarkers graph as i have never used this graph type before I have one crated with 3 coloums, ist is the title of the point and the other two hopld the data point AIR and INDEX

Hi,


Thanks for inquiring Aspose.Slides.

I like to share that you can edit the ScatterChartWithMarkers using Aspose.Slides just like other normal charts. Please visit this documentation link to see how to create ScatterChartWithMarkers. Please also visit this documentation link to see how to edit the charts. You can use the similar way to edit the ScatterChartWithMarkers. If there is still an issue then please share the sample application along with source presentation. Please also share the desired output presentation as well.

Many Thanks,

ChartDataCellFactory fact = chart.ChartData.ChartDataCellFactory;
ChartSeriesEx series = chart.ChartData.Series[0];
for (int i = 0; i < 10; i++)
{
string insertedValueair = extractedData.Rows[i][valuesUsed[2]].ToString();
string insertedValue = extractedData.Rows[i][valuesUsed[5]].ToString();
string[] catName = extractedData.Rows[i][valuesUsed[0]].ToString().Split('[', ']');
string cat = catName[1];
if (insertedValue.Equals("-") || insertedValue.Equals(""))
{
insertedValue = "0";
}
if (insertedValueair.Equals("-") || insertedValueair.Equals(""))
{
insertedValueair = "0";
}
fact.GetCell(0, catIndex, 0, cat);
catIndex++;

fact.GetCell(0, 0, 1, "AIR");
series.Values[i].Value = Math.Round(Convert.ToDouble(insertedValueair), MidpointRounding.AwayFromZero);
fact.GetCell(0, 0, 2, "Index");
series.Values[i].Value = Math.Round(Convert.ToDouble(insertedValue), MidpointRounding.AwayFromZero);
}
catIndex = 0;

i am using the code above and on the second line i amgetting a error that im getting is on the first line..
Index was out of range. must be non-negative and less than size of the collection Parameter name: index

Hi,


I have observed the sample code shared by you. Kindly share the source presentation with us for further investigation on my end.

Many Thanks,

Hi,


Thanks for sharing the information. I have tried opening the chart in PowerPoint 2010 and it failed to open that. Can you please share how you have created the chart. Also, there are variable extractedData and catIndex in your code that are not defined. Can you please share a working sample that is reproducing issue on your end and I may also use that. This way we will be both on same side of picture and I may help you better.

Many Thanks,

I have 10 random point on the graph and they all have different makers on with the name of the object inserted. I also have added the pptx again.

Hi,


I have used the presentation file shared by you and like to share that chart data for your chart is null. This is not an issue with Aspose.Slides. If you open the chart even in PowerPoint it shows message that linked data is not available for the chart. The linked data may be some excel file. Please create the chart again and see if you can access the chart data using PowerPoint. Then we will confirm that using Aspose.Slides.

Secondly, I have observed the sample code and cannot use that as it has some custom data tables extractedData and valuesUsed. There is one other variable catIndex. Pl;ease also provide this data so that I can modify the chart the way you are trying to. However, the issue that you are having is related to missing link with chart data. For your kind reference, I have shared the error message snapshot that I am having while editing your chart in PowerPoint.

Many Thanks,

i will not be able to provide the data but would it be possible for you to show me a method that would allow me to change the data on the chart with random numbers and tags.

Hi,


I have worked over the requirement for modifying the scatter chart. I have used the following sample code on my end to serve the purpose. For your convenience, I have also attached the source and generated presentations as your presentation is not even accessing chart data using PowerPoint. Please share, if I may help you further in this regard.


public static System.Data.DataTable GetTable()
{
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add(“AirValue”, typeof(double));
table.Columns.Add(“NormalValue”, typeof(double));
table.Rows.Add(2, 4);
table.Rows.Add(3, 1);
table.Rows.Add(6, 3);
table.Rows.Add(8, 2);
table.Rows.Add(7, 1);
table.Rows.Add(7, 6);
table.Rows.Add(2, 5);
table.Rows.Add(1, 7);
table.Rows.Add(9, 3);
table.Rows.Add(6, 5);
return table;
}
public static void updateScatterChart()
{
String path=@“D:\Aspose Data”;
PresentationEx pres = new PresentationEx(path + “ScatterChart.pptx”);
SlideEx slide = pres.Slides[0];
ChartEx chart = (ChartEx)slide.Shapes[0];
ChartDataEx data = chart.ChartData;
ChartDataCellFactory fact = chart.ChartData.ChartDataCellFactory;
ChartSeriesEx series = chart.ChartData.Series[0];
// series.XValues.RemoveAt(0);
// series.YValues.RemoveAt(0);
chart.ChartTitle.Text.Text = “AIR”;
System.Data.DataTable extractedData =GetTable();

for (int i = 0; i < 10; i++)
{
string insertedValueair = extractedData.Rows[i][“AirValue”].ToString();
string insertedValue = extractedData.Rows[i][“NormalValue”].ToString();
fact.GetCell(0, 0, 0, “AIR”);
fact.GetCell(0, 0, 1, “Index”);


series.XValues.Add(fact.GetCell(0, i + 1, 0, Convert.ToDouble(insertedValueair)));
series.YValues.Add(fact.GetCell(0, i + 1, 1, Convert.ToDouble(insertedValue)));


}
pres.Write(path + “UpdatedChart.pptx”);
}

Many Thanks,