From: Travis R. <tr...@gm...> - 2004-09-13 01:12:27
|
Is there any way to make a GradientPaint applied separately to each bar rather than across the entire graph? |
From: Chris M. <ch...@de...> - 2004-09-13 02:28:44
|
You could probably do this with a custom renderer. It would be actioned on every bar drawn though. So for instance I changed the color of a line point if it fell within a certain range with a PreAxisValueRenderListener. public void preRender( AxisValueRenderEvent axisValueRenderEvent ) { //---keep the current paint around Paint currentPaint= axisValueRenderEvent.getGraphics2D().getPaint(); axisValueRenderEvent.getGraphics2D().setPaint( this.forecastPaint ); // overwrite color if range test double value = axisValueRenderEvent.getiAxisChartDataSet().getValue( axisValueRenderEvent.getDataSetIndex(), axisValueRenderEvent.getValueIndex() ); if (value > loRange && value < hiRange) { axisValueRenderEvent.getGraphics2D().setPaint( this.inRangePaint ); } //---reset the current Paint axisValueRenderEvent.getGraphics2D().setPaint( currentPaint ); } } > -----Original Message----- > From: jch...@li... > [mailto:jch...@li...] On Behalf > Of Travis Reeder > Sent: Monday, 13 September 2004 1:12 p.m. > To: jch...@li... > Subject: [jCharts-users] Gradient on each bar rather than > across entire graph > > Is there any way to make a GradientPaint applied separately > to each bar rather than across the entire graph? > > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one > of 170 Project Admins to receive an Apple iPod Mini FREE for > your judgement on who ports your project to Linux PPC the > best. Sponsored by IBM. > Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > jCharts-users mailing list > jCh...@li... > https://lists.sourceforge.net/lists/listinfo/jcharts-users > > |
From: Chris M. <ch...@de...> - 2004-09-13 02:37:03
|
Of course you wouldn't set the Paint again!! Better code follows... public void preRender( AxisValueRenderEvent axisValueRenderEvent ) { // overwrite color if range test double value = axisValueRenderEvent.getiAxisChartDataSet().getValue( axisValueRenderEvent.getDataSetIndex(), axisValueRenderEvent.getValueIndex() ); if (value > loRange && value < hiRange) { axisValueRenderEvent.getGraphics2D().setPaint( this.inRangePaint ); } } |
From: Travis R. <tr...@gm...> - 2004-09-19 07:23:19
|
I don't think this will work very well for me since the paints are set dynamically while creating the graph, so how would I get at which paint is for which bar from the preRender method? I would need a axisValueRenderEvent.getPaint() or something. Why doesn't jcharts just set the paint for each bar it draws? Or another way of putting that is why does it have the current behaviour? Travis On Mon, 13 Sep 2004 14:34:45 +1200, Chris McKay <ch...@de...> wrote: > Of course you wouldn't set the Paint again!! Better code follows... > > > > public void preRender( AxisValueRenderEvent axisValueRenderEvent ) > { > // overwrite color if range test > double value = axisValueRenderEvent.getiAxisChartDataSet().getValue( > > axisValueRenderEvent.getDataSetIndex(), > > axisValueRenderEvent.getValueIndex() > ); > if (value > loRange && value < hiRange) { > axisValueRenderEvent.getGraphics2D().setPaint( > this.inRangePaint ); > } > } > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement on > who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > jCharts-users mailing list > jCh...@li... > https://lists.sourceforge.net/lists/listinfo/jcharts-users > |
From: Nathaniel G. A. <nat...@ya...> - 2004-09-20 20:47:41
|
why set the Paint n times, when you can set it once? The thought at the time was there would be a single Paint per dataset you could just have a member which counts? I think the index is passed in too. --- Travis Reeder <tr...@gm...> wrote: > I don't think this will work very well for me since the paints are set > dynamically while creating the graph, so how would I get at which > paint is for which bar from the preRender method? I would need a > axisValueRenderEvent.getPaint() or something. > > Why doesn't jcharts just set the paint for each bar it draws? Or > another way of putting that is why does it have the current behaviour? > > Travis > > > On Mon, 13 Sep 2004 14:34:45 +1200, Chris McKay <ch...@de...> wrote: > > Of course you wouldn't set the Paint again!! Better code follows... > > > > > > > > public void preRender( AxisValueRenderEvent axisValueRenderEvent ) > > { > > // overwrite color if range test > > double value = axisValueRenderEvent.getiAxisChartDataSet().getValue( > > > > axisValueRenderEvent.getDataSetIndex(), > > > > axisValueRenderEvent.getValueIndex() > > ); > > if (value > loRange && value < hiRange) { > > axisValueRenderEvent.getGraphics2D().setPaint( > > this.inRangePaint ); > > } > > } > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > > Project Admins to receive an Apple iPod Mini FREE for your judgement on > > who ports your project to Linux PPC the best. Sponsored by IBM. > > Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php > > _______________________________________________ > > jCharts-users mailing list > > jCh...@li... > > https://lists.sourceforge.net/lists/listinfo/jcharts-users > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement on > who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > jCharts-users mailing list > jCh...@li... > https://lists.sourceforge.net/lists/listinfo/jcharts-users > _______________________________ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com |
From: Chris M. <ch...@de...> - 2004-09-20 20:55:56
|
Yes, as you can see from the sample code the dataset index is passed in. Then if you want to count what bar you are up to then you just have a member var to do that, the class is called on every bar draw. I've done this when I wanted the bar colour to change when I reached a 'future' date. C > -----Original Message----- > From: jch...@li... > [mailto:jch...@li...] On Behalf > Of Nathaniel G. Auvil > Sent: Tuesday, 21 September 2004 8:48 a.m. > To: jch...@li... > Subject: Re: [jCharts-users] Gradient on each bar rather than > across entire graph > > > why set the Paint n times, when you can set it once? The > thought at the time was there would be a single Paint per dataset > > you could just have a member which counts? I think the index > is passed in too. > > > --- Travis Reeder <tr...@gm...> wrote: > > > I don't think this will work very well for me since the > paints are set > > dynamically while creating the graph, so how would I get at which > > paint is for which bar from the preRender method? I would need a > > axisValueRenderEvent.getPaint() or something. > > > > Why doesn't jcharts just set the paint for each bar it draws? Or > > another way of putting that is why does it have the current > behaviour? > > > > Travis > > > > > > On Mon, 13 Sep 2004 14:34:45 +1200, Chris McKay > <ch...@de...> wrote: > > > Of course you wouldn't set the Paint again!! Better code > follows... > > > > > > > > > > > > public void preRender( AxisValueRenderEvent > axisValueRenderEvent ) { > > > // overwrite color if range test > > > double value = > > > axisValueRenderEvent.getiAxisChartDataSet().getValue( > > > > > > axisValueRenderEvent.getDataSetIndex(), > > > > > > axisValueRenderEvent.getValueIndex() > > > ); > > > if (value > loRange && value < hiRange) { > > > axisValueRenderEvent.getGraphics2D().setPaint( > > > this.inRangePaint ); > > > } > > > } > > > > > > ------------------------------------------------------- > > > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be > one of 170 > > > Project Admins to receive an Apple iPod Mini FREE for > your judgement > > > on who ports your project to Linux PPC the best. Sponsored by IBM. > > > Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php > > > _______________________________________________ > > > jCharts-users mailing list > > > jCh...@li... > > > https://lists.sourceforge.net/lists/listinfo/jcharts-users > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > > Project Admins to receive an Apple iPod Mini FREE for your > judgement > > on who ports your project to Linux PPC the best. Sponsored by IBM. > > Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > > _______________________________________________ > > jCharts-users mailing list > > jCh...@li... > > https://lists.sourceforge.net/lists/listinfo/jcharts-users > > > > > > > _______________________________ > Do you Yahoo!? > Declare Yourself - Register online to vote today! > http://vote.yahoo.com > > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one > of 170 Project Admins to receive an Apple iPod Mini FREE for > your judgement on who ports your project to Linux PPC the > best. Sponsored by IBM. > Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > jCharts-users mailing list > jCh...@li... > https://lists.sourceforge.net/lists/listinfo/jcharts-users > > |