Annotations and CategoryPlot

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
poppins
Posts: 10
Joined: Thu Sep 01, 2005 12:17 pm
Location: India

Annotations and CategoryPlot

Post by poppins » Tue Sep 20, 2005 12:55 pm

I have to create this effect:

A 3D bar chart with pointer annotations. The condition is that i have to use a CategoryPlot, and a Bar3DRenderer to draw the chart.

Code: Select all

  |  |
  |  |
  |  |
  |  |              _________                                      
  |  |            /_________/|
  |  |            |        | |
  |  |            |      <--------------- Your current coverage
  |  |            |        | |
  |  |            |        | |
  |  |____________|        | |_______________
  |/_____________ |________|/________________


I am able to draw the 3D bar successfully. But the problems which i am having with annotations are as follows:

1] How to add a pointer annotation to a CategoryPlot, will i have to create my own class ?

2] I am given the starting position of annotation in terms of co-ordinates. Though CategoryAnnotation class requires category name and y-value. How can i specify the x-coordinate?

Is there some API which can map a category name to x- location on a CategoryPlot and vice versa ?

3] If i am given x-location as distance from RangeAxis in pixels, how can i have simulate this effect on CategoryPlot ?


Thanks,

poppins
Posts: 10
Joined: Thu Sep 01, 2005 12:17 pm
Location: India

More info

Post by poppins » Tue Sep 20, 2005 1:00 pm

Adding to the previous problem:

The distance in pixels means:

IF (x,y) is the starting location of annotation on the plot, then x is the distance from RangeAxis and y is the distance from DomainAxis, both in pixels.

Given the fact that we only have category names as column keys in CategoryPlot, is there some way i can mao the x-value to a category in the plot ?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Tue Sep 20, 2005 1:26 pm

Annotations are positioned using (category, y-value) coordinates because, in general, the size that the chart will be drawn is not known in advance. But the data area (the area inside the axes, in Java2D coordinates) is passed to the annotation's draw method, so you could write a custom annotation class that draws something at a fixed (x, y) position within the plot if you wanted to.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked