Results 1 to 2 of 2
- 11-21-2011, 05:59 AM #1
Member
- Join Date
- Nov 2011
- Posts
- 13
- Rep Power
- 0
Help getting Histogram chart example working
I have a histogram chart that I was given as an example. As I understand it, it is supposed to be working code, however, I can't get it to successfully compile.
I keep getting an error "operator <= cannot be applied to int,int[]"
Can someone help me see what I am missing? Am I supposed to be passing data to it from a section of my code? I'm having an incredibly hard time with graphing even after reading the tutorials. I can draw pre-defined shapes such as lines, rectangles, etc. but I am struggling with this one.
Your help is greatly appreciated.
Java Code:import javax.swing.*; public class Histogram { public static void main(String args[]) { int n[] = {19, 3, 20, 7, 13, 19, 3, 19,1}; String output = ""; output += "Element \tValue\tHistogram"; for (int i = 0; i < n.length; i++) { output += "\n" + i + "\t" + n + "\t"; //prints the bar for (int j = 1; j <= n; j++) output += '*'; } JTextArea outputArea = new JTextArea(11, 30); outputArea.setText(output); JOptionPane.showMessageDialog(null , outputArea, "Histogram Class", JOptionPane.INFORMATION_MESSAGE); System.exit(0); } }
- 11-21-2011, 06:12 AM #2
Similar Threads
-
Help with histogram
By Conan in forum New To JavaReplies: 5Last Post: 11-02-2011, 04:51 AM -
need help with name histogram
By cachico12 in forum New To JavaReplies: 1Last Post: 05-09-2011, 09:27 AM -
Interrupt Component While Working With Large File & Chart to Image
By sherazam in forum Java SoftwareReplies: 0Last Post: 02-08-2011, 09:51 AM -
histogram
By little_man in forum New To JavaReplies: 4Last Post: 11-13-2010, 02:38 AM -
Demo bar chart and pie chart
By Java Tip in forum java.awtReplies: 0Last Post: 06-24-2008, 12:22 AM
Bookmarks