mstover1 02/03/17 07:30:07 Modified: src/org/apache/jmeter/resources messages.properties messages_ja.properties messages_no.properties src/org/apache/jmeter/visualizers GraphVisualizer.java Log: Improving Graph Visualizer - thanks to Alf Hogemark Revision Changes Path 1.46 +4 -0 jakarta-jmeter/src/org/apache/jmeter/resources/messages.properties Index: messages.properties =================================================================== RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/resources/messages.properties,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- messages.properties 7 Mar 2002 23:03:13 -0000 1.45 +++ messages.properties 17 Mar 2002 15:30:06 -0000 1.46 @@ -97,6 +97,10 @@ graph_results_data=Data graph_results_average=Average graph_results_deviation=Deviation +graph_results_no_samples=No of Samples +graph_results_ms=ms +graph_results_latest_sample=Latest Sample +graph_choose_graphs=Graphs to Display spline_visualizer_title=Spline Visualizer spline_visualizer_maximum=Maximum spline_visualizer_minimum=Minimum 1.7 +4 -0 jakarta-jmeter/src/org/apache/jmeter/resources/messages_ja.properties Index: messages_ja.properties =================================================================== RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/resources/messages_ja.properties,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- messages_ja.properties 17 Mar 2002 03:05:36 -0000 1.6 +++ messages_ja.properties 17 Mar 2002 15:30:06 -0000 1.7 @@ -96,6 +96,10 @@ graph_results_data=\u30c7\u30fc\u30bf graph_results_average=\u5e73\u5747 graph_results_deviation=\u504f\u5dee +graph_results_no_samples=No of Samples +graph_results_ms=ms +graph_results_latest_sample=Latest Sample +graph_choose_graphs=Graphs to Display spline_visualizer_title=\u30b9\u30d7\u30e9\u30a4\u30f3\u30d3\u30b8\u30e5\u30a2\u30e9\u30a4\u30b6 spline_visualizer_maximum=\u6700\u5927 spline_visualizer_minimum=\u6700\u5c0f 1.3 +4 -0 jakarta-jmeter/src/org/apache/jmeter/resources/messages_no.properties Index: messages_no.properties =================================================================== RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/resources/messages_no.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- messages_no.properties 17 Mar 2002 03:05:36 -0000 1.2 +++ messages_no.properties 17 Mar 2002 15:30:06 -0000 1.3 @@ -84,6 +84,10 @@ graph_results_data=Data graph_results_average=Gjennomsnitt graph_results_deviation=Avvik +graph_results_no_samples=No of Samples +graph_results_ms=ms +graph_results_latest_sample=Latest Sample +graph_choose_graphs=Graphs to Display spline_visualizer_title=Spline visualiserer spline_visualizer_maximum=Maksimum spline_visualizer_minimum=Minimum 1.18 +103 -23 jakarta-jmeter/src/org/apache/jmeter/visualizers/GraphVisualizer.java Index: GraphVisualizer.java =================================================================== RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/visualizers/GraphVisualizer.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- GraphVisualizer.java 23 Feb 2002 01:21:07 -0000 1.17 +++ GraphVisualizer.java 17 Mar 2002 15:30:07 -0000 1.18 @@ -72,7 +72,7 @@ * *@author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> *@created February 8, 2001 - *@version $Revision: 1.17 $ $Date: 2002/02/23 01:21:07 $ + *@version $Revision: 1.18 $ $Date: 2002/03/17 15:30:07 $ */ public class GraphVisualizer extends JPanel implements ImageVisualizer, ItemListener,ModelSupported,GraphListener, @@ -89,6 +89,9 @@ private JTextField dataField; private JTextField averageField; private JTextField deviationField; + private JTextField maxYField = null; + private JTextField minYField = null; + private JTextField noSamplesField = null; /** * Constructor for the GraphVisualizer object @@ -109,16 +112,30 @@ { namePanel.updateGui(); graph.updateGui(); + noSamplesField.setText(Long.toString(model.getSampleCount())); dataField.setText(Long.toString(model.getCurrentData())); averageField.setText(Long.toString(model.getCurrentAverage())); deviationField.setText(Long.toString(model.getCurrentDeviation())); + updateYAxis(); } public void updateGui(Sample s) { + // We have received one more sample + noSamplesField.setText(Long.toString(model.getSampleCount())); dataField.setText(Long.toString(s.data)); averageField.setText(Long.toString(s.average)); deviationField.setText(Long.toString(s.deviation)); + updateYAxis(); + } + + /** + * Update the max and min value of the Y axis + */ + private void updateYAxis() + { + maxYField.setText(Long.toString(model.getMax())); + minYField.setText("0"); } private void init() @@ -143,6 +160,10 @@ namePanel = new NamePanel(model); mainPanel.add(namePanel); + // Set up panel where user can choose which graphs to display + JPanel chooseGraphsPanel = new JPanel(); + chooseGraphsPanel.setLayout(new FlowLayout()); + JLabel selectGraphsLabel = new JLabel(JMeterUtils.getResString("graph_choose_graphs")); data = new JCheckBox(JMeterUtils.getResString("graph_results_data")); data.setSelected(true); data.addItemListener(this); @@ -156,44 +177,107 @@ deviation.addItemListener(this); deviation.setForeground(Color.red); - JPanel checkPanel = new JPanel(); - checkPanel.setLayout(new GridLayout(0, 1)); - checkPanel.add(data); - checkPanel.add(average); - checkPanel.add(deviation); + chooseGraphsPanel.add(selectGraphsLabel); + chooseGraphsPanel.add(data); + chooseGraphsPanel.add(average); + chooseGraphsPanel.add(deviation); + // Set up the graph itself graph = new Graph(model); - JScrollPane graphScrollPanel = new JScrollPane(graph,JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); graphScrollPanel.setViewportBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); //graphScrollPanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); //graphScrollPanel.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); + + // Set up Y axis panel + JPanel graphYAxisPanel = new JPanel(); + graphYAxisPanel.setLayout(new BorderLayout()); + JPanel maxYPanel = new JPanel(new FlowLayout()); + JLabel maxYLabel = new JLabel(JMeterUtils.getResString("graph_results_ms")); + maxYField = new JTextField(5); + maxYField.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); + maxYField.setEditable(false); + maxYField.setForeground(Color.black); + maxYField.setBackground(getBackground()); + maxYField.setHorizontalAlignment(JTextField.RIGHT); + maxYPanel.add(maxYField); + maxYPanel.add(maxYLabel); + JPanel minYPanel = new JPanel(new FlowLayout()); + JLabel minYLabel = new JLabel(JMeterUtils.getResString("graph_results_ms")); + minYField = new JTextField(3); + minYField.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); + minYField.setEditable(false); + minYField.setForeground(Color.black); + minYField.setBackground(getBackground()); + minYField.setHorizontalAlignment(JTextField.RIGHT); + minYPanel.add(minYField); + minYPanel.add(minYLabel); + graphYAxisPanel.add(maxYPanel, BorderLayout.NORTH); + graphYAxisPanel.add(minYPanel, BorderLayout.SOUTH); + + // Set up footer of graph which displays numerics of the graphs + JPanel dataPanel = new JPanel(); + JLabel dataLabel = new JLabel(JMeterUtils.getResString("graph_results_latest_sample")); + dataLabel.setForeground(Color.black); dataField = new JTextField(5); + dataField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); dataField.setEditable(false); dataField.setForeground(Color.black); dataField.setBackground(getBackground()); + dataPanel.add(dataLabel); + dataPanel.add(dataField); + JPanel averagePanel = new JPanel(); + JLabel averageLabel = new JLabel(JMeterUtils.getResString("graph_results_average")); + averageLabel.setForeground(Color.blue); averageField = new JTextField(5); + averageField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); averageField.setEditable(false); averageField.setForeground(Color.blue); averageField.setBackground(getBackground()); + averagePanel.add(averageLabel); + averagePanel.add(averageField); + JPanel deviationPanel = new JPanel(); + JLabel deviationLabel = new JLabel(JMeterUtils.getResString("graph_results_deviation")); + deviationLabel.setForeground(Color.red); deviationField = new JTextField(5); + deviationField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); deviationField.setEditable(false); deviationField.setForeground(Color.red); deviationField.setBackground(getBackground()); + deviationPanel.add(deviationLabel); + deviationPanel.add(deviationField); + JPanel noSamplesPanel = new JPanel(); + JLabel noSamplesLabel = new JLabel(JMeterUtils.getResString("graph_results_no_samples")); + noSamplesField = new JTextField(10); + noSamplesField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + noSamplesField.setEditable(false); + noSamplesField.setForeground(Color.black); + noSamplesField.setBackground(getBackground()); + noSamplesPanel.add(noSamplesLabel); + noSamplesPanel.add(noSamplesField); + + JPanel graphInfoPanel = new JPanel(); + graphInfoPanel.setLayout(new FlowLayout()); + graphInfoPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + + graphInfoPanel.add(noSamplesPanel); + graphInfoPanel.add(dataPanel); + graphInfoPanel.add(averagePanel); + graphInfoPanel.add(deviationPanel); + + // Set up the graph with header, footer, Y axis and graph display + JPanel graphPanel = new JPanel(); + graphPanel.setLayout(new BorderLayout()); + graphPanel.add(graphYAxisPanel, BorderLayout.WEST); + graphPanel.add(chooseGraphsPanel, BorderLayout.NORTH); + graphPanel.add(graphScrollPanel, BorderLayout.CENTER); + graphPanel.add(graphInfoPanel, BorderLayout.SOUTH); - JPanel showPanel = new JPanel(); - showPanel.setLayout(new GridLayout(0, 1)); - showPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - showPanel.add(dataField); - showPanel.add(averageField); - showPanel.add(deviationField); - + // Add the main panel and the graph this.add(mainPanel,BorderLayout.NORTH); - this.add(checkPanel, BorderLayout.WEST); - this.add(graphScrollPanel, BorderLayout.CENTER); - this.add(showPanel, BorderLayout.EAST); + this.add(graphPanel, BorderLayout.CENTER); } /** @@ -242,7 +326,7 @@ dataField.setText("0000"); averageField.setText("0000"); deviationField.setText("0000"); - + updateYAxis(); repaint(); } @@ -253,10 +337,6 @@ */ public String toString() { - return "Show the samples analysys as dot plots"; + return "Show the samples analysis as dot plots"; } - - - - }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>