Java Problem

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Java Problem

heaney05
I am trying to make a barchart and call values from a text-fields,the values will come from a database when a selected row in clicked on. How would i go about this?

I know how to get the values into the bar chart but just not from database to text-fields when selected.

 DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
        String ID = txtID.getText();
           String AvgWind = txtAvgWind.getText();
           String MinWind = txtMinWind.getText();
           String MaxWind = txtMaxWind.getText();
           String AvgPower = txtAvgPower.getText();
           String MinPower = txtMinPower.getText();
           String MaxPower = txtMaxPower.getText();
             
           
           dataset2.setValue(new Double(AvgPower), "Value", "Average Power");
           dataset2.setValue(new Double(MinPower), "Value", "Min Power");// y axis is first
           dataset2.setValue(new Double(MaxPower), "Value", "Max Power");//x axis is second
           
           JFreeChart chart2 = ChartFactory.createBarChart("Power Values", "ID", "", dataset2);
           chart2.setBackgroundPaint(Color.BLUE);
           chart2.getTitle().setPaint(Color.RED);
           CategoryPlot p=chart2.getCategoryPlot();
           p.setRangeGridlinePaint(Color.BLACK);
           ChartFrame frame = new ChartFrame("Bar Chart for Power",chart2);
           frame.setVisible(true);
           frame.setSize(500,500);
Loading...