java - Apply image/pattern to pie section instead of normal color -
instead of using normal plot.setsectionpaint()
method fill color of pie section, possible add together pattern or image shown below.
i have got requirement colors hard distinguish when printed in black & white printer.
worst case if not possible have utilize 2 different colors distinguishable on b/w printer
setsectionpaint
allows implementation of interface java.awt.paint
passed. color
1 class implements paint
, there others, such texturepaint
.
this code create texturepaint
bluish line pattern in example:
bufferedimage texture = new bufferedimage(1, 30, bufferedimage.type_int_rgb); graphics2d g = texture.creategraphics(); g.setcolor(color.white); g.fillrect(0, 0, 1, 30); g.setcolor(new color(0x26a2d6)); g.fillrect(0, 0, 1, 20); g.dispose(); texturepaint texturepaint = new texturepaint(texture, texture.getraster().getbounds());
you can pass texturepaint
argument setsectionpaint
.
java jfreechart
No comments:
Post a Comment