error with chart

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v5)  /  error with chart

DynamicPDF CoreSuite for .NET (v5) Forum

 Apr 01 2014 3:49 PM
Hello,
I am having problems with chart creation. When I try to insert chart generated by DynamicPDF into PDF document, following error occur in Draw method:
[ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length]

I'm using a VB.NET CONSOLE PROJECT in visual studio 2012 and I added the reference to the dll framework 2.0.

I do some test and it's the chart that cause problem. The same code works in VB.NET WEB APPLICATION

Here is the code that I tried :

 ' Create a PDF Document
Dim MyDocument As New Document()

' Create a Page and add it to the MyDocument
Dim MyPage As New Page()
MyDocument.Pages.Add(MyPage)



      ' Create a MyChart
      Dim MyChart As New Chart(0, 0, 400, 230)

      ' Create a plot area
      Dim MyPlotArea As PlotArea = MyChart.PrimaryPlotArea

      ' Create header titles and add it to the MyChart
      Dim MyTitle1 As New Title("Website Visitors")
      Dim MyTitle2 As New Title("Year 2007")
      MyChart.HeaderTitles.Add(MyTitle1)
      MyChart.HeaderTitles.Add(MyTitle2)

      ' Create a indexed bar series and add values to it
      Dim MyBarSeries1 As New IndexedBarSeries("Website A")
      MyBarSeries1.Values.Add(New Single() {5, 7, 9, 6})
      Dim MyBarSeries2 As New IndexedBarSeries("Website B")
      MyBarSeries2.Values.Add(New Single() {4, 2, 5, 8})
      Dim MyBarSeries3 As New IndexedBarSeries("Website C")
      MyBarSeries3.Values.Add(New Single() {2, 4, 6, 9})

      ' Add indexed bar series to the plot area
      MyPlotArea.Series.Add(MyBarSeries1)
      MyPlotArea.Series.Add(MyBarSeries2)
      MyPlotArea.Series.Add(MyBarSeries3)

      ' Create a title and add it to the xaxis
      Dim MylTitle As New Title("Visitors (in millions)")
      MyBarSeries1.XAxis.Titles.Add(MylTitle)

      'Adding AxisLabels to the yAxis
      MyBarSeries1.YAxis.Labels.Add(New IndexedYAxisLabel("Q1", 0))
      MyBarSeries1.YAxis.Labels.Add(New IndexedYAxisLabel("Q2", 1))
      MyBarSeries1.YAxis.Labels.Add(New IndexedYAxisLabel("Q3", 2))
      MyBarSeries1.YAxis.Labels.Add(New IndexedYAxisLabel("Q4", 3))

' Add the MyChart to the MyPage
MyPage.Elements.Add(MyChart)
' Save the PDF
MyDocument.Draw("C:/MyDocument.pdf")
 Apr 02 2014 9:52 AM
Posted by a ceTe Software moderator
Hello,

Please try using the using the latest version 5.1.2 DynamicPDF for .NET product DLL file in your application and see if it works for you. You can download latest version 5 DLL file by logging into the customer area using your version 5 product serial number.

If you continue getting similar error even after using the latest then please send over the following details to our support team so that they can look into it further.
1. Sample project using which we can recreate the error.
2. Full error message along with stack trace.

Thanks,
ceTe Software Support Team.

 Apr 02 2014 10:54 AM
I already use the last version 5 DLL so I send you a mail with my vb.net project zipped attached to the mail.
 Apr 02 2014 1:22 PM
Posted by a ceTe Software moderator
Hello,

This issue has been fixed in the latest build of v5.1.2. Please email us at support@cete.com to obtain the latest build.

Thanks,
ceTe Software Support Team.
 Apr 02 2014 1:24 PM
It works.
Thanks.

All times are US Eastern Standard time. The time now is 12:29 AM.