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

Message ListMessage List     Post MessagePost Message

  pie border
Posted by Leo on May-09-2013 03:48
Hello, Peter,
How to add black border color to a pie?
c->setBorderColor (.... does not seem to work.
Thanks.

  Re: pie border
Posted by Peter Kwan on May-09-2013 14:00
Hi Leo,

You may use PieChart.setSectorStyle. There are several examples ("Circular Label Layout", "Pie Chart with Legend (1)", "Exploded Pie Chart" , "Multi-Pie Chart") included in ChartDirector that demonstrates pies with borders. May be you can use them as references.

Hope this can help.

Regards
Peter Kwan

  Re: pie border
Posted by Leo on May-09-2013 22:43
Attachments:
Thanks for the reply.
I am half way there.
How do I get *just* the black border on the whole pie, but *no* borders on the slices?
~~~
1 #!/usr/bin/perl
  2 use perlchartdir;
  3
  4 sub createChart
  5 {
  6     my $img = shift;
  7
  8     # the tilt angle of the pie
  9     #my $depth = int($img) * 5 + 5;
10     my $depth = 0;
11
12     # The data for the pie chart
13     my $data = [0, 0];
14
15     # Create a PieChart object of size 100 x 110 pixels
16     my $c = new PieChart(100,100);
17
18     # Set the center of the pie at (50, 55) and the radius to 38 pixels
19     $c->setPieSize(50, 50, 48);
20
21     # Set the depth of the 3D pie
22     $c->set3D($depth);
23
24 #$c->setColors2($perlchartdir::DataColor, [0x444897, 0xdddddd]);
25 #$c->setColors2($perlchartdir::DataColor, [0x444897, 0xAEF8F7]);
26 $c->setColors2($perlchartdir::DataColor, [0xbbbbbb, 0xbbbbbb]);
27
28
29     # Add a title showing the depth
30     #$c->addTitle("Depth = $depth pixels", "arial.ttf", 8);
31
32     # Set the pie data
33     $c->setData($data);
34     # Disable the sector labels by setting the color to Transparent
35     $c->setLabelStyle("", 8, $perlchartdir::Transparent);
36
37 $c->setSectorStyle(0, 0x000000, 3);
38
39
40     # Output the chart
41     $c->makeChart("100pc.png")
42     #$c->makeChart("pie01.png")
43 }
44
45 createChart(0);
peter01.png

  Re: pie border
Posted by Peter Kwan on May-10-2013 02:48
Hi Leo,

If it is a 2D pie chart, and sectors are not exploded, you can just draw a circle border around the pie, or you may draw a bigger black circle under the pie.

An example is:


$c->getDrawArea()->circle(50, 50, 48, 48, 0x000000, 0x000000);

................


Another example is:

.... create pie chart as usual .....

my $c = new PieChart(100,100);
$c->setPieSize(50, 50, 48);

.................

$c->makeChart3()->circle(50, 50, 48, 48, 0x000000, $perlchartdir::Transparent);
$c->makeChart("100pc.png")


Hope this can help.

Regards
Peter Kwan

  Re: pie border
Posted by Leo on May-11-2013 03:14
Attachments:
Thanks for the reply.
It works!!
Only one problem, how do I make the edge bolder?
~~~
#!/usr/bin/perl
use perlchartdir;

$c = new PieChart(100,100);
$c->getDrawArea()->circle(50, 50, 48, 48, 0x000000, 0xcccccc);
$c->makeChart("100pc.png");
~~~
peter02.png

  Re: pie border
Posted by Peter Kwan on May-13-2013 23:05
Hi Leo,

May be you can consider the first method I mentioned, which is to draw a bigger black solid circle under the pie. The black circle can be a few pixels larger than the pie in radius, and this can create a thick border around the pie.

Hope this can help.

Regards
Peter Kwan