Hi
I am getting the following error after trying to add Data label from values.
Syncfusion.OfficeChart.Implementation.XmlSerialization.Charts.ChartSerializator.serializeDataLabelRangeCache(XmlWriter writer, Dictionary`2 values)
at Syncfusion.OfficeChart.Implementation.XmlSerialization.Charts.ChartSerializator.SeriealizeValuesFromCellsRange(XmlWriter writer, ChartSerieImpl series)
at Syncfusion.OfficeChart.Implementation.XmlSerialization.Charts.ChartSerializator.SerializeScatterSeries(XmlWriter writer, ChartSerieImpl series)
at Syncfusion.OfficeChart.Implementation.XmlSerialization.Charts.ChartSerializator.SerializeChartSeries(XmlWriter writer, ChartImpl chart, ChartSerieImpl firstSeries, SerializeSeriesDelegate serializator)
at Syncfusion.OfficeChart.Implementation.XmlSerialization.Charts.ChartSerializator.SerializeScatterChart(XmlWriter writer, ChartImpl chart, ChartSerieImpl firstSeries)
at Syncfusion.OfficeChart.Implementation.XmlSerialization.Charts.ChartSerializator.SerializeMainChartTypeTag(XmlWriter writer, ChartImpl chart, Int32 groupIndex)
at Syncfusion.OfficeChart.Implementation.XmlSerialization.Charts.ChartSerializator.SerializePlotArea(XmlWriter writer, ChartImpl chart, RelationCollection relations)
at Syncfusion.OfficeChart.Implementation.XmlSerialization.Charts.ChartSerializator.SerializeChart(XmlWriter writer, ChartImpl chart, String chartItemName)
at Syncfusion.Presentation.FileDataHolder.WriteChart(PresentationChart chart)
at Syncfusion.Presentation.DrawingSerializator.SerializeGraphicFrame(XmlWriter xmlWriter, Shape shape)
at Syncfusion.Presentation.DrawingSerializator.SerializeShapes(XmlWriter xmlWriter, BaseSlide slide)
at Syncfusion.Presentation.DrawingSerializator.SerializeShapeTree(XmlWriter xmlWriter, BaseSlide slide)
at Syncfusion.Presentation.Serializator.SerializeCommonSlide(XmlWriter xmlWriter, BaseSlide slide)
at Syncfusion.Presentation.Serializator.SerializeSlide(XmlWriter xmlWriter, Slide slide)
at Syncfusion.Presentation.FileDataHolder.WriteSlides()
at Syncfusion.Presentation.FileDataHolder.Write()
at Syncfusion.Presentation.FileDataHolder.WriteDocument(Stream stream)
at Syncfusion.Presentation.Presentation.SaveFromStream(Stream stream)
at Syncfusion.Presentation.Presentation.SaveAsStream(Stream fileStream)
at Syncfusion.Presentation.Presentation.Save(Stream stream)
at Revuze.Pro.Reports.Services.ReportsService.GenerateSwotPPT(SwotDataModel swotModel) in C:\Users\moran\source\repos\Pro\Revuze.Pro.Reports\Revuze.Pro.Reports\Services\ReportsService.cs:line 137
I want to add data to replace the x and y values and the column1 value.
Thank you.
The issue was with the data, once I limit the value of the bullets to 2 decimal points after the dot, I stopped getting the error message.
But for some reason, I can't see the custom data labels after I create the file even in the example you sent me.
value from cells
|
FileStream Stream = new FileStream(@"Swot template.pptx", FileMode.Open);
IPresentation pptxDoc = Presentation.Open(Stream);
Stream.Close();
//Retrieves the slide instance.
ISlide slide = pptxDoc.Slides[3];
//Gets the chart in slide
IPresentationChart chart = slide.Shapes[41] as IPresentationChart;
chart.ChartData.SetValue(2, 1, 0.2);
chart.ChartData.SetValue(2, 2, 0.3);
chart.ChartData.SetValue(2, 3, "Testvalue1");
chart.ChartData.SetValue(3, 1, 0.4);
chart.ChartData.SetValue(3, 2, 0.5);
chart.ChartData.SetValue(3, 3, "Testvalue2");
chart.ChartData.SetValue(4, 1, 0.6);
chart.ChartData.SetValue(4, 2, 0.7);
chart.ChartData.SetValue(4, 3, "Testvalue3");
IOfficeChartSerie serie = chart.Series[0];
serie.DataPoints.DefaultDataPoint.DataLabels.IsValue = true;
serie.DataPoints.DefaultDataPoint.DataLabels.IsCategoryName = true;
Stream = new FileStream(@"Swot template_output.pptx", FileMode.Create);
//Save and close the presentation
pptxDoc.Save(Stream);
Stream.Close();
pptxDoc.Close(); |
Hi
This is not working for me, I need the data from a specific column. My issue is that I can't see the values as data labels. I only see them after I
var dataLabels = chart.Series[0].DataPoints.DefaultDataPoint.DataLabels;
dataLabels.ValueFromCellsRange =
chart.ChartData[ _startRowIndex, 3,bulletGraphData.Count + 1, 3];
dataLabels.Position = OfficeDataLabelPosition.Above;
dataLabels.ShowLeaderLines = false;
dataLabels.IsValueFromCells = true;
chart.Refresh();
I attached the ppt file I have created so you can reproduce the issue
Hi
The issue has been resolved.
Once I replaced the line of code:
IPresentation pptxDoc = Presentation.Open(new FileStream(_generalTempaltePath, FileMode.Open)).Clone();
With yours:
FileStream Stream = new FileStream(_swotTemplate, FileMode.Open);
IPresentation pptxDoc = Presentation.Open(Stream);
Stream.Close();