How to remove Intermediate Intervals in Y aixs of Step Chart
How to remove Intermediate Intervals in Y aixs of Step Chart
Hi,
In our application we are using the xy step chart in which currently we are getting some intermediate values in y axis rather than our essential values.
For eg: we are getting the label values like below
10e1,10e2,10e3................10e5 but we need in the way as 10e1,10e2,10e4
Right now we are using the below method for acheiving the above
xAxis.setExpTickLabelsFlag(true);
Is there any other method in jfree to remove the intermediate intervals and define the labels in exponenatial way.Please adivse.
Thanks,
Sat
In our application we are using the xy step chart in which currently we are getting some intermediate values in y axis rather than our essential values.
For eg: we are getting the label values like below
10e1,10e2,10e3................10e5 but we need in the way as 10e1,10e2,10e4
Right now we are using the below method for acheiving the above
xAxis.setExpTickLabelsFlag(true);
Is there any other method in jfree to remove the intermediate intervals and define the labels in exponenatial way.Please adivse.
Thanks,
Sat
Re: How to remove Intermediate Intervals in Y aixs of Step Chart
inetmediate values, inetmediate intervals, I couldnt get what you mean by that probably 'cuz of my English?
but have you take a look on the forum?
http://www.jfree.org/phpBB2/viewtopic.php?f=3&t=31605
but have you take a look on the forum?
http://www.jfree.org/phpBB2/viewtopic.php?f=3&t=31605
Re: How to remove Intermediate Intervals in Y aixs of Step Chart
Hi,
Thanks For your response.Actually in our implementation we are trying to create a xy axis step chart by using the below values.
double[][] series = new double[][]{
{774.19,580.65,580.65,387.10,387.10,193.55,193.55,0.00,0.00,0.00},
{1,1,12,12,111,111,4642,4642,22358,22358}};
y - axis value -{774.19,580.65,580.65,387.10,387.10,193.55,193.55,0.00,0.00,0.00}
x - axis value -{1,1,12,12,111,111,4642,4642,22358,22358}};
For x -axis we need the values to be plotted between the intervals of 10 power 0,10 power1,10 power 2.But we tried the below method
LogarithmicAxis xAxis = new LogarithmicAxis("Cycles (cumulative)"); which by default taking the x-axis intervals as 1,2,3,4,5,10,20,30,100,150,200
But we need the intervals as mentioned above with power in which we have to plot the graph with the x-axis values.Hope my need is clear for you now.Will you please help me to acheive this.It will be greatful if we get the exact method which will help us to acheive this or a sample code.
Thanks
SAT
Thanks For your response.Actually in our implementation we are trying to create a xy axis step chart by using the below values.
double[][] series = new double[][]{
{774.19,580.65,580.65,387.10,387.10,193.55,193.55,0.00,0.00,0.00},
{1,1,12,12,111,111,4642,4642,22358,22358}};
y - axis value -{774.19,580.65,580.65,387.10,387.10,193.55,193.55,0.00,0.00,0.00}
x - axis value -{1,1,12,12,111,111,4642,4642,22358,22358}};
For x -axis we need the values to be plotted between the intervals of 10 power 0,10 power1,10 power 2.But we tried the below method
LogarithmicAxis xAxis = new LogarithmicAxis("Cycles (cumulative)"); which by default taking the x-axis intervals as 1,2,3,4,5,10,20,30,100,150,200
But we need the intervals as mentioned above with power in which we have to plot the graph with the x-axis values.Hope my need is clear for you now.Will you please help me to acheive this.It will be greatful if we get the exact method which will help us to acheive this or a sample code.
Thanks
SAT
Re: How to remove Intermediate Intervals in Y aixs of Step Chart
"class LogarithmicAxis" doesnt have but if you use "class Logaxis" there is a method:
Code: Select all
xAxis.setBase(10);
Re: How to remove Intermediate Intervals in Y aixs of Step Chart
Hi ,
I tried the method form Logaxis which you have specified.But now am not able to veiw any label information in the x-axis.Its plain without any values.Anyother methods which may help?
Thanks
SAT
I tried the method form Logaxis which you have specified.But now am not able to veiw any label information in the x-axis.Its plain without any values.Anyother methods which may help?
Thanks
SAT
Re: How to remove Intermediate Intervals in Y aixs of Step Chart

what do u mean no label information? i see the tick mark labels
Re: How to remove Intermediate Intervals in Y aixs of Step Chart
Hi ,
Will you please share me the code for the graph sample with the labels which you have attached?the one which we tried doesnt show the values like 10^1,10^2 as shown in the graph which you have attached.
Thanks
SAT
Will you please share me the code for the graph sample with the labels which you have attached?the one which we tried doesnt show the values like 10^1,10^2 as shown in the graph which you have attached.
Thanks
SAT
Re: How to remove Intermediate Intervals in Y aixs of Step Chart
i didnt do anything than just creating defult everything.
new XYPlot()
new JFreeChart()
new LogAxis()
new NumberAxis()
new XYStepRenderer()
new XYSeries()
new XYSeriesCollection()
new ChartPanel()
thats quite all i ve used, as i said, just the defaults
new XYPlot()
new JFreeChart()
new LogAxis()
new NumberAxis()
new XYStepRenderer()
new XYSeries()
new XYSeriesCollection()
new ChartPanel()
thats quite all i ve used, as i said, just the defaults
Re: How to remove Intermediate Intervals in Y aixs of Step Chart
Hi,
Thanks for your suggestion.But actually i want my graph to look in this way.
[img]http://en.wikipedia.org/wiki/File:LogLo ... f_Line.GIF[/img]
the x axis value needs to come as how in this sample graph.Will you please suggest me the exact method to achieve the same.
Thanks,
SAT
Thanks for your suggestion.But actually i want my graph to look in this way.
[img]http://en.wikipedia.org/wiki/File:LogLo ... f_Line.GIF[/img]
the x axis value needs to come as how in this sample graph.Will you please suggest me the exact method to achieve the same.
Thanks,
SAT
Re: How to remove Intermediate Intervals in Y aixs of Step Chart
Subscripts and superscripts are not supported without writing some code.
Re: How to remove Intermediate Intervals in Y aixs of Step Chart
Hi
It will be helpful if you share me some code for this.
thanks,
SAT
It will be helpful if you share me some code for this.
thanks,
SAT
Re: How to remove Intermediate Intervals in Y aixs of Step Chart
The method that actually draws the tick labels is called
If you look at the supplied source code, you will see that a utility method from org.jfree.text.TextUtilities is used
You would need to modify the entire call chain so that instances of java.text.AttributedString are used instead of java.lang.String
This would be a non-trivial change, to put it mildly. You might be able to hack together a local override that parsed the string just before it was printed but it would be very brittle.
Code: Select all
protected AxisState drawTickMarksAndLabels(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge)
Code: Select all
TextUtilities.drawRotatedString(tick.getText(), g2, anchorPoint[0], anchorPoint[1], tick.getTextAnchor(), tick.getAngle(), tick.getRotationAnchor());
This would be a non-trivial change, to put it mildly. You might be able to hack together a local override that parsed the string just before it was printed but it would be very brittle.
Re: How to remove Intermediate Intervals in Y aixs of Step Chart
Code: Select all
public void setMinorTickMarksVisible(boolean flag)
what is sathu77 is asking and what skunk is trying to solve, i dont get. is it log axis on both axes we are talking about or what?
Re: How to remove Intermediate Intervals in Y aixs of Step Chart
I thought he was asking how to display 10¹ ... 10² ... 10³ instead of 10^1 ... 10^2 ... 10^3 as that was the only difference between the axis you displayed and the one he linked to
Re: How to remove Intermediate Intervals in Y aixs of Step Chart
Hi ,
Exactly as you said we need to display 10¹ ... 10² ... 10³ instead of 10^1 ... 10^2 ... 10^3.
The below is the way we tried to obtain the same but failed.Will anybody guide to acheive that
If i try to create the superscript also it only done through the paint(),which paint and clears.
And one more thing is in our applicationo we are generating simulataneously stepchart,curve chart for the same x,y values.What ever changes we are doing should no be like supporting only step or curve or line but all.Please advise.
Thanks,
SAT
Exactly as you said we need to display 10¹ ... 10² ... 10³ instead of 10^1 ... 10^2 ... 10^3.
The below is the way we tried to obtain the same but failed.Will anybody guide to acheive that
Code: Select all
//BELOW CODE TO CREATE CHART.
JFreeChart chart = ChartFactory.createXYLineChart(
null,
"Range Values ",
"",
dataset, //CREATED DATA SET EARLIER AND PASSING HERE.
PlotOrientation.HORIZONTAL,
true,
true,
false
);
// CREATED ATTRIBUTE
for(curVal=0;curVal<7;curVal++){
String strVal=10+""+curVal;
as = new AttributedString(strVal);
as.addAttribute(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER, 2, 3);
}
AttributedCharacterIterator attrItr=as.getIterator();
Map<Attribute, Object> mapAttrKeys= attrItr.getAttributes();
for (Map.Entry<Attribute,Object> entry : mapAttrKeys.entrySet()) {
Attribute attrKey = (Attribute )entry.getKey();
Object attrValue= entry.getValue();
System.out.println("Attribute Key L:--> "+attrKey+" Attribute Value :--> "+attrValue.toString());
}
ghs.drawString(as.getIterator(), 30+curVal*20, 50+curVal*5);
// BELOW CODE FOR SETTING THE LABLES FOR X AXIS.
LogAxis xAxis = new LogAxis("");
xAxis.setLowerBound(1);
xAxis.setUpperBound(1000000);
xAxis.setTickLabelsVisible(true);
xAxis.setTickLabelInsets(RectangleInsets.ZERO_INSETS);
xAxis.setTickLabelFont(new Font("SansSerif", Font.BOLD, 10));
plot.setRangeAxis(xAxis);
And one more thing is in our applicationo we are generating simulataneously stepchart,curve chart for the same x,y values.What ever changes we are doing should no be like supporting only step or curve or line but all.Please advise.
Thanks,
SAT