I am attempting to take a document and replace a certain text placeholder with a pie chart. I am able to import a chart, but it is the wrong chart type and contains no values (but the chart title has been changed). The chart displays a y- and x-axis from 2 to 9 and -1 to 6 respectively with no values.
Any assistance would be much appreciated. The code seems straightforward (the chart code is from one of your demo's):
' Main call
Dim CPI As New ReplaceEvaluator(AddressOf IncludeCPIEvaluator)
doc.Range.Replace(New Regex("<>"), CPI, False)
Private Function IncludeCPIEvaluator(ByVal sender As Object, ByVal e As ReplaceEvaluatorArgs) As ReplaceAction
Dim obuilder As New DocumentBuilder(e.MatchNode.Document)
obuilder.MoveTo(e.MatchNode)
obuilder.InsertImage(DetermineCPIValue)
e.Replacement = ""
Return ReplaceAction.Replace
End Function
Public function DetermineCPIValue() as drawing.image
Dim c As Aspose.Chart.Chart = New Aspose.Chart.Chart
c.Titles.Add(New Aspose.Chart.Title)
c.Titles(0).Text = "Doughnut 2D, All Exploded"
c.BackColor = Color.FromArgb(153, 204, 255)
c.ChartArea.BackColor = Color.FromArgb(247, 243, 233)
c.ChartArea.LegendBox.BackColor = Color.FromArgb(255, 255, 204)
c.ChartArea.PaletteType = Aspose.Chart.PaletteType.Fresh
c.ChartArea.LegendBox.LegendPositionType = LegendPositionType.Bottom
c.ChartArea.LegendBox.LayoutType = Aspose.Chart.LayoutType.Row
Dim s As Aspose.Chart.Series = New Aspose.Chart.Series
s.ChartType = ChartType.Doughnut
s.CustomAttributes.ExplodedWidthRate = 0.1F
s.CustomAttributes.IsAllExploded = True
s.DefaultDataPoint.IsLabelVisible = True
s.DefaultDataPoint.LabelValue = Aspose.Chart.DataLabelValueType.DataPointName
s.DataPoints.Add(New Aspose.Chart.DataPoint("Point 0", 0, 5))
s.DataPoints.Add(New Aspose.Chart.DataPoint("Point 1", 1, 7))
s.DataPoints.Add(New Aspose.Chart.DataPoint("Point 2", 2, 3))
s.DataPoints.Add(New Aspose.Chart.DataPoint("Point 3", 3, 8))
s.DataPoints.Add(New Aspose.Chart.DataPoint("Point 4", 4, 4))
s.DataPoints.Add(New Aspose.Chart.DataPoint("Point 5", 5, 6))
c.SeriesCollection.Add(s)
Return c.GetChartImage
End Function