ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  ChartDirector V7.0 vs 6.x
Posted by Sean Laks on Jul-01-2022 18:32

   I downloaded v7 on my machine and ran the following sample code (from your lib) for a donut chart.

Note: Only a subsection of the entire code pasted here

PieChart c = new PieChart(600, 320, Chart.brushedSilverColor(), Chart.Transparent, 2);
c.setRoundedFrame(0xffffff, 20);

// Add a title using 18pt Times New Roman Bold Italic font. #Set top/bottom margins to 8 pixels.
TextBox title = c.addTitle("Donut Chart Demonstration", "Times New Roman Bold Italic", 18);
title.setMargin2(0, 0, 8, 8);

// Add a 2 pixels wide separator line just under the title
c.addLine(10, title.getHeight(), c.getWidth() - 11, title.getHeight(), Chart.LineColor, 2);

// Set donut center at (160, 175), and outer/inner radii as 110/55 pixels
c.setDonutSize(160, 175, 110, 55);

// Set the pie data and the pie labels
c.setData(data, labels);

// Use ring shading effect for the sectors


I invoke makeChart2(5) to get an SVG o/p. I then simply convert that into string as follows:(ignore syntax please)

byte[] bytearray = c.makeChart2(5)
String svgstring = new String(bytearray)

svgstring now has proper HTML tags and data that can be inserted as is into a HTML file and chart rendered FINE



When I run this SAME code using v6.x (@ my work, licensed copy), 2 issues arise.

  1) Chart.brushedSilverColor() parameter, adding a line separator and Ringshading is being flagged as unrecognized

  2) the chart output var svgstring now contains funky symbols (same code works in v7)

What am I missing here?


  Re: ChartDirector V7.0 vs 6.x
Posted by Peter Kwan on Jul-01-2022 22:25
Hi Sean Laks,

Is it possible your ChartDirector is of an older version (like version 4) instead of version 6?

Please try the following code:

PieChart c = new PieChart(600, 320);
c.addTitle("CD Version = " + Integer.toHexString(Chart.getVersion()));

The above will create an empty with the ChartDirector version displayed on the chart title. The chart will be saved as a PNG image at "/path/to/aaa.png".

ChartDirector version 4 does not have brushedSilverColor, RingShading and does not support SVG. The Chart.SVG is not defined. If you try to output with parameter 5 (which is the Chart.SVG if it exists), ChartDirector version 4 will just output the chart in the default format, which is PNG.

ChartDirector version 6 should support all of the above.

Best Regards
Peter Kwan

  Re: ChartDirector V7.0 vs 6.x
Posted by sean laks on Jul-02-2022 02:03

  I am all good. I was using VEr 4. I found Ver 7 in our internal artifactory.