JFreeChart- Display coordinate value .

JFreeChart- Display coordinate value .

How to Mark Coordinte value on top of the bar ?

View Answers

December 11, 2010 at 5:33 PM

Hi Friend,

Try the following code:

import java.io.*;
import java.text.*;
import org.jfree.data.*;
import org.jfree.ui.*;
import org.jfree.chart.*;
import org.jfree.chart.axis.*;
import org.jfree.chart.plot.*;
import org.jfree.data.category.*;
import org.jfree.chart.renderer.category.*;
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;

public class ChartDemo{
public static void main(String arg[]){
  DefaultCategoryDataset dataset = new DefaultCategoryDataset();
  dataset.setValue(60, "Marks", "A");
  dataset.setValue(75, "Marks", "B");
  dataset.setValue(40, "Marks", "C");
  dataset.setValue(90, "Marks", "D");
  dataset.setValue(20, "Marks", "E");
  JFreeChart chart = ChartFactory.createBarChart("Bar Chart","Student", "Marks", dataset, 
  PlotOrientation.VERTICAL, false,true, false);
  CategoryPlot p = chart.getCategoryPlot(); 
  NumberAxis rangeAxis = (NumberAxis) p.getRangeAxis();
  rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
  BarRenderer renderer = (BarRenderer) p.getRenderer();
  DecimalFormat decimalformat1 = new DecimalFormat("##");
  renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", decimalformat1));
  renderer.setItemLabelsVisible(true);
  chart.getCategoryPlot().setRenderer(renderer);
  ChartFrame frame=new ChartFrame("Bar Chart",chart);
  frame.setVisible(true);
  frame.setSize(350,450);
    }
}

Thanks









Related Tutorials/Questions & Answers:
JFreeChart- Display coordinate value .
JFreeChart- Display coordinate value .  How to Mark Coordinte value on top of the bar
Jfreechart chart display problem
Jfreechart chart display problem  Using JSP and Jfreechart displays the chart fine on an internal browser in eclipse but doesnt display it on Chrome...="java.awt.GradientPaint" %> <% int value=Integer.parseInt
Advertisements
Using JFreeChart to display recent changes in a time series
Using JFreeChart to display recent changes in a time series  Using JFreeChart to display recent changes in a time series
How to display jfreechart at specified place in jsp
How to display jfreechart at specified place in jsp  I have a jsp page where i need to display the chart at specified position...("Inet", 20); JFreeChart chart = ChartFactory.createPieChart3D
jfreechart display from access database data.
jfreechart display from access database data.  I have made a database... to retrieve the data from the access database using prepared statement and then display the bar graph using jfreechart API .This whole retrieval and display of chart
To store value in session & display it
To store value in session & display it  Hello..I m trying to run...="add"> <!-- <input type="checkbox" name="book1cat" value="JSP" />JSP <input type="checkbox" name="book1cat" value="C
Display of value in Tabel cell
Display of value in Tabel cell  I have added a custom field..., Object value , boolean isSelected, int row, int column){ JPanel...(editor.getTableCellEditorComponent(table, value, isSelected, row, column)); panel.add
How to display Jfreechart from servlet in jsp web page at specified location
How to display Jfreechart from servlet in jsp web page at specified... to display the chart in web page. I generated the chart using Jfreechart in Servlet which is in image format.plz sir give me the code to display this chart
. Display JavaScript dropdown selected value
you select any value from list, alert will display that. In var.... Display JavaScript dropdown selected value  How to get the selected value from dropdown box? I am using javascript.   <html> <
how to show value and percentage in piechart sections from database using jfreechart
how to show value and percentage in piechart sections from database using... jfreechart.Now I need to display the values and their percentage in the sections... JFreeChart setup and the basic servlet * configuration. * * @param
jfreechart
jfreechart  hi how install jfreechart? and how free download jcommon? plz insert link for this? thanks   Hi Friend, Please visit the following link:ADS_TO_REPLACE_1 Download JFreechart Download jfreechart-1.0.13.zip
how to display the value of termcell name in label
how to display the value of termcell name in label  want to display the tercell name in label report of pending apllication of termcellname code...="display"%> <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%> <
java script display value - Java Beginners
java script display value  my code is below: my problem is: the value 'firstname' is not showed with getparameter in .jsp file? (when click submit button in form) Main file: Name: file java
how to display textbox value based on selected option value?
how to display textbox value based on selected option value?  Hi,I... on first value I finished above code. ID: xx Name:xx xx is baesd on second and first value. But it is that l can't do that. now, l post my code
ModuleNotFoundError: No module named 'coordinate'
ModuleNotFoundError: No module named 'coordinate'  Hi, My Python... 'coordinate' How to remove the ModuleNotFoundError: No module named 'coordinate' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'coordinate'
ModuleNotFoundError: No module named 'coordinate'  Hi, My Python... 'coordinate' How to remove the ModuleNotFoundError: No module named 'coordinate' error? Thanks   Hi, In your python environment you
how to use dropdown list in JSP and display value in same page
how to use dropdown list in JSP and display value in same page  I... one option the value must get displayed below it in the same page as: Value selected = B Now if choose another option, new message should be printed
how to display each arraylist value on new page in jsp
how to display each arraylist value on new page in jsp  hi!!!! i want to display each arraylist value on new page in jsp????? and also want to access the arraylist values using next button..... any help would be appreciated
Version of jfreechart>jfreechart dependency
List of Version of jfreechart>jfreechart dependency
I am not able to display the selected value of my combobox
I am not able to display the selected value of my combobox   <?php echo "<select name=\"hello\">\n"; echo "<option value=\"NULL\">...["unitcode"]; $i=$i+1; echo "<option value=''>$strB<
how to display data from database according to entered value in search field
how to display data from database according to entered value in search... BMI value and display the results accordingly. 1)search.jsp: <html> <...;/b></td> <td>: <input type="text" name="bmi_value" id="BMI
How to collect Java input field value display into Jtable?
How to collect Java input field value display into Jtable?  <p>... as the following information. - display the value in the JTable. If in the GUI as per view...;text rate - input interest rate</li> <li>text Result - Display
ModuleNotFoundError: No module named 'ybc-coordinate'
ModuleNotFoundError: No module named 'ybc-coordinate'  Hi, My... named 'ybc-coordinate' How to remove the ModuleNotFoundError: No module named 'ybc-coordinate' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'coordinate-finder'
ModuleNotFoundError: No module named 'coordinate-finder'  Hi, My... named 'coordinate-finder' How to remove the ModuleNotFoundError: No module named 'coordinate-finder' error? Thanks   Hi, In your
how to display the nearest palaces for the given latitude and longitude value in google map in android
how to display the nearest palaces for the given latitude and longitude value in google map in android  i m working in android. i need to display the nearest palaces with their image for the given latitude and longitude value
JFreechart & JCommon
JFreechart & JCommon   hi........... thanks a lot. The code is running successfully and able to get the output. Thanks once again
Artifacts of jfreechart
List of Artifacts of jfreechart maven depenency
ModuleNotFoundError: No module named 'coordinate-country-lookup'
ModuleNotFoundError: No module named 'coordinate-country-lookup'  Hi...: No module named 'coordinate-country-lookup' How to remove the ModuleNotFoundError: No module named 'coordinate-country-lookup' error? Thanks  
ModuleNotFoundError: No module named 'coordinate-country-lookup'
ModuleNotFoundError: No module named 'coordinate-country-lookup'  Hi...: No module named 'coordinate-country-lookup' How to remove the ModuleNotFoundError: No module named 'coordinate-country-lookup' error? Thanks  
display
display  please tell me how to display the content from database.. if we click on any image using servlets/jsp...please
Error in JfreeChart
Error in JfreeChart  I am getting an error when i am using jfreechart... the following link and download the jfreechart api:ADS_TO_REPLACE_2 http://www.brothersoft.com/jfreechart-download-15712.html Then extract the api and put
How to display data fom MySQL DataBase-table in to JSP file by submitting a value in combobox.
How to display data fom MySQL DataBase-table in to JSP file by submitting a value in combobox.   I have the same problem.plz help me. I have MySQL... have to display the Nodename and packageno. i.e.,select nodename,packageno from
base the value of first combo box, how i display the second combox - JSP-Servlet
base the value of first combo box, how i display the second combox    i have a combo box for classes. my requirement is when i select the class, if class is 11 or 12 the second combo box of subject should be appear. please
Re: base the value of first combo box, how i display the second combox - JSP-Servlet
Re: base the value of first combo box, how i display the second combox   Dear Sir, in this program when i click on submit button, the corrosponding value of combo box should be sent. but when i clicked to submit button, it do
Re: base the value of first combo box, how i display the second combox - JSP-Servlet
Re: base the value of first combo box, how i display the second combox    thanks for your reply. i want to know suppose the second combo box appear only when i select the class 11th or 12th. please review. your answer
Error in JfreeChart
Error in JfreeChart  I am getting an error when i am using jfreechart for graph generation, that is: D:\my\linechart.java:5: package org.jfree.chart does not exist import org.jfree.chart.*;ADS_TO_REPLACE_1 what is the reason
Box And Whisker Chart Example using JFreeChart
Box And Whisker Chart Example using JFreeChart... to create a box and whisker chart using JFreeChart. Code of the chart given below shows product value at different date . In the code given below we have
Display JList value selected from the JOptionPane
Display JList value selected from the JOptionPane In this section, we are going to select the particular value from the JOptionPane combobox and displayed... and display the value of JList value
Maven Repository/Dependency: jfreechart | jfreechart
Maven Repository/Dependency of Group ID jfreechart and Artifact ID jfreechart. Latest version of jfreechart:jfreechart dependencies. # Version Release Date 1 0.9.18 01
jfreechart
Maven Repository/Dependency: com.github.618lf | swak-coordinate
Maven Repository/Dependency of Group ID com.github.618lf and Artifact ID swak-coordinate. Latest version of com.github.618lf:swak-coordinate dependencies. # Version Release Date 1
Candle Stick Chart Example using JFreeChart
Candle Stick Chart Example using JFreeChart... a candle stick chart using JFreeChart. Code of the chart given below shows price value on the different dates. In the example given below we have
jfreechart maven dependency
jfreechart maven dependency  Hi, I want to use jfreechart library in my Java project. My project is maven based and I am trying to find the maven dependency of jfreechart. What is jfreechart maven dependency
Version of jfree>jfreechart dependency
List of Version of jfree>jfreechart dependency
Maven Dependency jfreechart >> 0.9.17
You should include the dependency code given in this page to add Maven Dependency of jfreechart >> jfreechart version0.9.17 in your project
Maven Dependency jfreechart >> 0.9.2
You should include the dependency code given in this page to add Maven Dependency of jfreechart >> jfreechart version0.9.2 in your project
Maven Dependency jfreechart >> 0.9.8
You should include the dependency code given in this page to add Maven Dependency of jfreechart >> jfreechart version0.9.8 in your project
Maven Dependency jfreechart >> 0.9.16
You should include the dependency code given in this page to add Maven Dependency of jfreechart >> jfreechart version0.9.16 in your project
Maven Dependency jfreechart >> 0.9.18
You should include the dependency code given in this page to add Maven Dependency of jfreechart >> jfreechart version0.9.18 in your project
Maven Dependency jfreechart >> 0.9.19
You should include the dependency code given in this page to add Maven Dependency of jfreechart >> jfreechart version0.9.19 in your project

Ads