hi,
How to change the range for z Axis in bubble.
The problem now is bubbles in my chart are entirely covering my chart.
I just wanted to reduce the scale for z-Axis.
Thanks,
tony
Bubble chart
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
You'll need to scale the z-values in your dataset, since the size of the bubbles is taken from the z-value but displayed relative to the x and y axes.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


how to scale the the z axis value . for the same dataset i m having perfect chart in excel .but in jfree bubble chart ,the size of the bubble doesnt fits perfect.
i found that if the difference b/w the largest value and the smallest on either the domain or range axis is too large ,then my bubbles are bad.
plz any one post the answer.....
i found that if the difference b/w the largest value and the smallest on either the domain or range axis is too large ,then my bubbles are bad.
plz any one post the answer.....
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
I don't have Excel, so perhaps you could post a sample dataset and the resulting chart from Excel so I could see what the difference is.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


much happy at ur reply.
here s my dataset .though the variation are too much .still i m getting good bubbles in excel.
but jfree does not.
i have set my ranges dynamically from min and max values of the domain and range axis.
my dataset
x y z
6.02 17.14 93.46
9.8 43.8 118.928
18.53 0.1 13.83
25.02 1.5 6.05
14.78 499.6 3.2
13.479 -7.4 16.404
here s my dataset .though the variation are too much .still i m getting good bubbles in excel.
but jfree does not.
i have set my ranges dynamically from min and max values of the domain and range axis.
my dataset
x y z
6.02 17.14 93.46
9.8 43.8 118.928
18.53 0.1 13.83
25.02 1.5 6.05
14.78 499.6 3.2
13.479 -7.4 16.404
dataset in clear
x ------------------ y ---------------------------------z
6.02------------------- 17.14------------------------------ 93.46
9.8 ---------------------43.8----------------------------- 118.928
18.53 ------------------0.1 ---------------------------------13.83
25.02 ---------------1.5------------------------------------- 6.05
14.78---------------- 499.6--------------------------------- 3.2
13.479 ----------------(-7.4)------------------------------- 16.404
how can i scale the z-axis range values relative to domain or range axis value
6.02------------------- 17.14------------------------------ 93.46
9.8 ---------------------43.8----------------------------- 118.928
18.53 ------------------0.1 ---------------------------------13.83
25.02 ---------------1.5------------------------------------- 6.05
14.78---------------- 499.6--------------------------------- 3.2
13.479 ----------------(-7.4)------------------------------- 16.404
how can i scale the z-axis range values relative to domain or range axis value
JFreeChart 1.0.10 and 1.0.11
The equation is quite simple.(XYZDataset, DefaultXYZDataset)
When we instantiate renderer for bubble chart. We declare as follow:
XYItemRenderer xyItemRendererBubble = new XYBubbleRenderer(XYBubbleRenderer.SCALE_ON_BOTH_AXIS);
XYItemRenderer xyItemRendererBubble = new XYBubbleRenderer(XYBubbleRenderer.SCALE_ON_DOMAIN_AXIS);
XYItemRenderer xyItemRendererBubble = new XYBubbleRenderer(XYBubbleRenderer.SCALE_ON_RANGE_AXIS);
or
XYItemRenderer xyItemRendererBubble = new XYBubbleRenderer(); //default SCALE_ON_BOTH_AXIS
Let's us open the XYBubbleRenderer class at package org.jfree.chart.renderer.xy
Goto method: public void drawItem(Graphics2D g2, ...etc.)
At swtich(getScaleType()), u will observe 3 case: SCALE_ON_DOMAIN_AXIS, SCALE_ON_RANGE_AXIS and default
default equal to SCALE_ON_BOTH_AXIS.
In this example, I use SCALE_ON_RANGE_AXIS as sample, cause relative easy to understand.
In ur chart, on range-axis maybe form by 100. And it divide into 10 dotted lines which 1 interval is 10.
Then, when u Want to draw a bubble which the Z-value (equal to diameter of bubble=2 radius).
If diameter = 10, then the z-value for the seriesItem should be 10.0 If u dataset range axis is 10000,
then u want a bubble conquer 10% of the chart range, the z-axis(diameter) should be 1000 indeed.
*To automatic calculate to fit the best z-value on various chart type. U will need a double value called dRatio.
dZ * dRatio will equal to the Z-value if in SCALE_ON_RANGE_AXIS type.
How to determine dRatio? U may use ur talented brain to think about it.
(CLUE:based on dataset on different stock)
Pretty easy, ya?
The equation is quite simple.(XYZDataset, DefaultXYZDataset)
When we instantiate renderer for bubble chart. We declare as follow:
XYItemRenderer xyItemRendererBubble = new XYBubbleRenderer(XYBubbleRenderer.SCALE_ON_BOTH_AXIS);
XYItemRenderer xyItemRendererBubble = new XYBubbleRenderer(XYBubbleRenderer.SCALE_ON_DOMAIN_AXIS);
XYItemRenderer xyItemRendererBubble = new XYBubbleRenderer(XYBubbleRenderer.SCALE_ON_RANGE_AXIS);
or
XYItemRenderer xyItemRendererBubble = new XYBubbleRenderer(); //default SCALE_ON_BOTH_AXIS
Let's us open the XYBubbleRenderer class at package org.jfree.chart.renderer.xy
Goto method: public void drawItem(Graphics2D g2, ...etc.)
At swtich(getScaleType()), u will observe 3 case: SCALE_ON_DOMAIN_AXIS, SCALE_ON_RANGE_AXIS and default
default equal to SCALE_ON_BOTH_AXIS.
In this example, I use SCALE_ON_RANGE_AXIS as sample, cause relative easy to understand.
In ur chart, on range-axis maybe form by 100. And it divide into 10 dotted lines which 1 interval is 10.
Then, when u Want to draw a bubble which the Z-value (equal to diameter of bubble=2 radius).
If diameter = 10, then the z-value for the seriesItem should be 10.0 If u dataset range axis is 10000,
then u want a bubble conquer 10% of the chart range, the z-axis(diameter) should be 1000 indeed.
*To automatic calculate to fit the best z-value on various chart type. U will need a double value called dRatio.
dZ * dRatio will equal to the Z-value if in SCALE_ON_RANGE_AXIS type.
How to determine dRatio? U may use ur talented brain to think about it.
(CLUE:based on dataset on different stock)
Pretty easy, ya?