List of usage examples for java.awt Color lightGray
Color lightGray
To view the source code for java.awt Color lightGray.
Click Source Link
From source file:com.modeln.build.ctrl.charts.CMnPatchCountChart.java
/** * Create a chart representing an arbitrary collection of name/value pairs. * The data is passed in as a hashtable where the key is the name and the * value is the number items. /*from w w w. j av a 2s . co m*/ */ public static final JFreeChart getBarChart(Hashtable<String, Integer> data, String title, String nameLabel, String valueLabel) { JFreeChart chart = null; // Sort the data by name Vector<String> names = new Vector<String>(); Enumeration nameList = data.keys(); while (nameList.hasMoreElements()) { names.add((String) nameList.nextElement()); } Collections.sort(names); // Populate the dataset with data DefaultCategoryDataset dataset = new DefaultCategoryDataset(); Iterator keyIter = names.iterator(); while (keyIter.hasNext()) { String name = (String) keyIter.next(); Integer value = data.get(name); dataset.addValue(value, valueLabel, name); } // Create the chart chart = ChartFactory.createBarChart(title, /*title*/ nameLabel, /*categoryAxisLabel*/ valueLabel, /*valueAxisLabel*/ dataset, /*dataset*/ PlotOrientation.VERTICAL, /*orientation*/ false, /*legend*/ false, /*tooltips*/ false /*urls*/ ); // get a reference to the plot for further customization... CategoryPlot plot = (CategoryPlot) chart.getPlot(); //chartFormatter.formatMetricChart(plot, "min"); // Set the chart colors plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // disable bar outlines... BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); renderer.setShadowVisible(false); final GradientPaint gp = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.blue); renderer.setSeriesPaint(0, gp); // Set the label orientation CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); return chart; }
From source file:edu.ucla.stat.SOCR.chart.demo.QQData2DataDemo.java
/** * Creates a chart./*from www . j a v a2 s. c om*/ * * @param dataset the data for the chart. * * @return a chart. */ protected JFreeChart createChart(XYDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, //"Data vs Data Q-Q plot", // chart title domainLabel, // x axis label rangeLabel, // y axis label dataset, // data PlotOrientation.VERTICAL, !legendPanelOn, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); // renderer.setShapesVisible(true); renderer.setBaseShapesFilled(true); // renderer.setLinesVisible(false); renderer.setSeriesLinesVisible(1, true); renderer.setSeriesShapesVisible(1, false); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShapesVisible(0, true); //renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator()); // change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(false); rangeAxis.setUpperMargin(0.02); rangeAxis.setLowerMargin(0.02); // rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setUpperMargin(0.02); domainAxis.setLowerMargin(0.02); // domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. setQQSummary(dataset); return chart; }
From source file:net.sourceforge.processdash.ui.web.reports.RadarPlot.java
private void initialise() { this.interiorGap = DEFAULT_INTERIOR_GAP; // this.circular = true; this.radius = DEFAULT_RADIUS; this.showAxisLabels = true; this.axisLabelFont = DEFAULT_AXIS_LABEL_FONT; this.axisLabelPaint = DEFAULT_AXIS_LABEL_PAINT; this.axisLabelGap = DEFAULT_AXIS_LABEL_GAP; // this.itemLabelGenerator = null; // this.urlGenerator = null; this.plotLinePaint = ADAPTIVE_COLORING; this.axisPaint = Color.black; this.axisStroke = DEFAULT_OUTLINE_STROKE; this.gridLinePaint = Color.lightGray; this.gridLineStroke = DEFAULT_OUTLINE_STROKE; this.plotLineStroke = DEFAULT_LINE_STROKE; setForegroundAlpha(0.5f);//from w w w .j ava 2s . c om setInsets(new RectangleInsets(0, 5, 5, 5)); }
From source file:v800_trainer.XYGraphik.java
public JPanel StartGraphik(JCicloTronic JTronicHandle) { int num = 0;/*from ww w.java2 s . c o m*/ int num2 = 0, num0, num02; //fr Streckendifferenz int selected; int single; int i; int j; int Stunden; int Minuten; int Sekunden; int Tagadder = 0; int Linecount = 0; Second xTime[]; double xWerte[]; double xWerte2[];//fr Streckendifferenz double y1Werte[]; double y2Werte[]; double y3Werte[]; double y4Werte[]; double y5Werte[]; double y6Werte[]; double y7Werte[]; double y8Werte[]; double y8bWerte[]; double y9Werte[]; double y10Werte[]; JFreeChart chart; Rectangle2D.Double Legendenpunkt = new Rectangle2D.Double(); selected = JTronicHandle.Auswahl_Graphik.getSelectedIndex(); if (selected == 0) { single = 1; } else { single = 0; } //Defaultchart erstellen if (JTronicHandle.Graphik_Radio_Strecke.isSelected()) { XYSeries dataset = new XYSeries(""); dataset.add(1, 1); XYSeriesCollection dataset1 = new XYSeriesCollection(dataset); chart = ChartFactory.createXYLineChart("Multiple Axis Demo 1", "Strecke", "", dataset1, PlotOrientation.HORIZONTAL, true, true, false); } else { TimeSeries dataset = new TimeSeries(""); dataset.add(new Second(1, 1, 1, 1, 1, 1900), 1); TimeSeriesCollection dataset1 = new TimeSeriesCollection(dataset); chart = ChartFactory.createTimeSeriesChart("Multiple Axis Demo 1", "Zeit", "", dataset1, true, true, false); } ; //Tooltips fr Zeitachse einstellen // XYToolTipGenerator ToolTip = new StandardXYToolTipGenerator("{0}: ({1}, {2})", // (DateFormat) new SimpleDateFormat("kk:mm.ss"), // NumberFormat.getInstance()); // chart.setAntiAlias(true); chart.setNotify(false); if (single == 0) { chart.setTitle(JTronicHandle.Statistikhandle.TourData[JTronicHandle.Auswahl_Graphik .getSelectedIndex()].DataProperty.getProperty("Titel", "")); chart.addSubtitle(new TextTitle(JTronicHandle.Auswahl_Graphik.getItemAt(selected).toString())); } else { chart.setTitle("Mehrfache Daten"); } chart.setBackgroundPaint(Color.white); JTronicHandle.applyChartTheme(chart); XYPlot plot = chart.getXYPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setRangeCrosshairLockedOnData(false); plot.setDomainCrosshairLockedOnData(false); int Anzahl_Kurven = Integer.parseInt(JTronicHandle.Properties.getProperty("AnzahlKurven", "5")) + 1; if (Anzahl_Kurven > JTronicHandle.Auswahl_Graphik.getItemCount()) { Anzahl_Kurven = JTronicHandle.Auswahl_Graphik.getItemCount(); } try { for (j = 0; j < (Anzahl_Kurven - 2) * single + 1; j++) { if (single == 1) { selected = j + 1; } num = JTronicHandle.Statistikhandle.TourData[selected].Datenpunkte; num2 = JTronicHandle.Statistikhandle.TourData[selected].ZahlStreckenPunkte; num0 = JTronicHandle.Statistikhandle.TourData[1].ZahlStreckenPunkte; num02 = JTronicHandle.Statistikhandle.TourData[1].Datenpunkte; xTime = new Second[num]; xWerte = new double[num]; y1Werte = new double[num]; y2Werte = new double[num]; y3Werte = new double[num]; y4Werte = new double[num]; y5Werte = new double[num]; y6Werte = new double[num]; y7Werte = new double[num]; y8Werte = new double[num]; y8bWerte = new double[num]; xWerte2 = new double[num2]; y9Werte = new double[num2]; y10Werte = new double[num]; for (i = 0; i < num; i++) { xWerte[i] = (double) JTronicHandle.Statistikhandle.TourData[selected].Strecke_gesZeit[i]; y1Werte[i] = (double) JTronicHandle.Statistikhandle.TourData[selected].Geschw_gesZeit[i]; y2Werte[i] = (double) JTronicHandle.Statistikhandle.TourData[selected].Hoehe_gesZeit[i]; y3Werte[i] = (double) JTronicHandle.Statistikhandle.TourData[selected].Hf_gesZeit[i]; y4Werte[i] = (double) JTronicHandle.Statistikhandle.TourData[selected].Temperatur_gesZeit[i]; y5Werte[i] = (double) JTronicHandle.Statistikhandle.TourData[selected].Steigp_gesZeit[i]; y6Werte[i] = (double) JTronicHandle.Statistikhandle.TourData[selected].Steigm_gesZeit[i]; y7Werte[i] = (double) JTronicHandle.Statistikhandle.TourData[selected].av_Geschw_gesZeit[i]; y8Werte[i] = (double) JTronicHandle.Statistikhandle.TourData[selected].Cadence_gesZeit[i]; y8bWerte[i] = (double) JTronicHandle.Statistikhandle.TourData[selected].Schritt_lnge[i]; } if (JTronicHandle.Graphik_check_Abstand.isSelected() && single == 1 && j != 0) { int p = 0; if (JTronicHandle.Graphik_Radio_Strecke.isSelected()) { for (i = 0; i < num2; i++) { xWerte2[i] = (double) JTronicHandle.Statistikhandle.TourData[selected].Streckenskala[i]; if (i < num0) { y9Werte[i] = (double) JTronicHandle.Statistikhandle.TourData[selected].ZeitberStrecke[i] - JTronicHandle.Statistikhandle.TourData[1].ZeitberStrecke[i]; } else { y9Werte[i] = y9Werte[i - 1]; } } } else { for (i = 0; i < num; i++) { p = 0; while (p < num02 - 1 && (JTronicHandle.Statistikhandle.TourData[selected].gesZeit[i] >= JTronicHandle.Statistikhandle.TourData[1].gesZeit[p])) { p++; } ; if (i < num02) { y10Werte[i] = (double) (JTronicHandle.Statistikhandle.TourData[selected].Strecke_gesZeit[i] - JTronicHandle.Statistikhandle.TourData[1].Strecke_gesZeit[p]) * 100.0; } else { y10Werte[i] = y10Werte[i - 1]; } } } } //Zeitbasis laden for (i = 0; i < num; i++) { Tagadder = 0; Stunden = (int) (JTronicHandle.Statistikhandle.TourData[selected].gesZeit[i] / 3600); Minuten = (int) ((JTronicHandle.Statistikhandle.TourData[selected].gesZeit[i] - Stunden * 3600) / 60); Sekunden = (int) (JTronicHandle.Statistikhandle.TourData[selected].gesZeit[i] - Stunden * 3600 - Minuten * 60); if (single == 0) { Minuten = Minuten + JTronicHandle.Statistikhandle.TourData[selected].StartMinuten; if (Minuten >= 60) { Minuten -= 60; Stunden++; } ; Stunden = Stunden + JTronicHandle.Statistikhandle.TourData[selected].StartStunden; } ; while (Stunden >= 24) { Stunden -= 24; Tagadder += 1; } ; try { if (single == 0) { xTime[i] = new Second(Sekunden, Minuten, Stunden, JTronicHandle.Statistikhandle.TourData[selected].Tag + Tagadder, JTronicHandle.Statistikhandle.TourData[selected].Monat, JTronicHandle.Statistikhandle.TourData[selected].Jahr); } else { xTime[i] = new Second(Sekunden, Minuten, Stunden, 1 + Tagadder, 1, 1900); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "StartGraphik\n" + e + "Zeile " + i + " Zeitfehler " + Stunden + " " + Minuten + " " + Sekunden, "Achtung!", JOptionPane.ERROR_MESSAGE); } } if (JTronicHandle.Graphik_Radio_Strecke.isSelected()) { //Streckenachse if (JTronicHandle.Graphik_check_Geschwindigkeit.isSelected()) { XYSeries dataset = new XYSeries( "Geschwindigkeit [km/h] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xWerte[i], y1Werte[i]); } XYSeriesCollection dataset1 = new XYSeriesCollection(dataset); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_Hhe.isSelected()) { XYSeries dataset = new XYSeries( "Hhe [m] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xWerte[i], y2Werte[i]); } XYSeriesCollection dataset1 = new XYSeriesCollection(dataset); NumberAxis axis2 = new NumberAxis("Hhe [m]"); axis2.setLabelFont(plot.getRangeAxis().getLabelFont()); axis2.setTickLabelFont(plot.getRangeAxis().getTickLabelFont()); axis2.setAutoRangeIncludesZero(true); axis2.setLabelPaint(Color.BLACK); axis2.setTickLabelPaint(Color.BLACK); axis2.setAxisLinePaint(Color.BLACK); plot.setRangeAxis(1, axis2); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 1); XYItemRenderer renderer = new StandardXYItemRenderer(); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } ; if (JTronicHandle.Graphik_check_HF.isSelected()) { XYSeries dataset = new XYSeries( "Herzfrequenz [b/min] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xWerte[i], y3Werte[i]); } XYSeriesCollection dataset1 = new XYSeriesCollection(dataset); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_Temp.isSelected()) { XYSeries dataset = new XYSeries( "Temperatur [C] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xWerte[i], y4Werte[i]); } XYSeriesCollection dataset1 = new XYSeriesCollection(dataset); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_Steigung_p.isSelected()) { XYSeries dataset = new XYSeries( "Steigung [%] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xWerte[i], y5Werte[i]); } XYSeriesCollection dataset1 = new XYSeriesCollection(dataset); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_Steigung_m.isSelected()) { XYSeries dataset = new XYSeries( "Steigung [m/min] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xWerte[i], y6Werte[i]); } XYSeriesCollection dataset1 = new XYSeriesCollection(dataset); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_av_Geschw.isSelected()) { XYSeries dataset = new XYSeries( "av Geschw. [km/h] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xWerte[i], y7Werte[i]); } XYSeriesCollection dataset1 = new XYSeriesCollection(dataset); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_Cadence.isSelected()) { XYSeries dataset = new XYSeries( "Cadence [n/min] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xWerte[i], y8Werte[i]); } XYSeriesCollection dataset1 = new XYSeriesCollection(dataset); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_Schrittlnge.isSelected()) { XYSeries dataset = new XYSeries( "Schrittlnge [cm] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xWerte[i], y8bWerte[i]); } XYSeriesCollection dataset1 = new XYSeriesCollection(dataset); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_Abstand.isSelected() && single == 1 && j != 0) { XYSeries dataset = new XYSeries( "Zeitabstand [s] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr + " - " + JTronicHandle.Statistikhandle.TourData[1].Tag + "." + JTronicHandle.Statistikhandle.TourData[1].Monat + "." + JTronicHandle.Statistikhandle.TourData[1].Jahr); for (i = 0; i < num2; i++) { dataset.add(xWerte2[i], y9Werte[i]); } XYSeriesCollection dataset1 = new XYSeriesCollection(dataset); NumberAxis axis3 = new NumberAxis("Abstand"); axis3.setLabelFont(plot.getRangeAxis().getLabelFont()); axis3.setTickLabelFont(plot.getRangeAxis().getTickLabelFont()); axis3.setAutoRangeIncludesZero(true); axis3.setLabelPaint(Color.BLACK); axis3.setTickLabelPaint(Color.BLACK); plot.setRangeAxis(2, axis3); plot.setRangeAxisLocation(2, AxisLocation.BOTTOM_OR_RIGHT); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 2); XYItemRenderer renderer = new StandardXYItemRenderer(); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } } else { //Zeitachse if (JTronicHandle.Graphik_check_Geschwindigkeit.isSelected()) { TimeSeries dataset = new TimeSeries( "Geschwindigkeit [km/h] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xTime[i], y1Werte[i]); } TimeSeriesCollection dataset1 = new TimeSeriesCollection(dataset); ValueAxis axis = plot.getRangeAxis(); axis.setLabelPaint(Color.BLACK); axis.setTickLabelPaint(Color.BLACK); plot.setRangeAxis(0, axis); plot.setRangeAxisLocation(0, AxisLocation.BOTTOM_OR_LEFT); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(2);//, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount)); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_Hhe.isSelected()) { TimeSeries dataset = new TimeSeries( "Hoehe [m] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xTime[i], y2Werte[i]); } TimeSeriesCollection dataset1 = new TimeSeriesCollection(dataset); NumberAxis axis2 = (NumberAxis) plot.getRangeAxis().clone(); axis2.setLabel("Hhe [m]"); axis2.setAutoRangeIncludesZero(true); axis2.setLabelPaint(Color.BLACK); axis2.setTickLabelPaint(Color.BLACK); axis2.setAxisLinePaint(Color.BLACK); plot.setRangeAxis(1, axis2); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 1); XYItemRenderer renderer = new StandardXYItemRenderer(2);//, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_HF.isSelected()) { TimeSeries dataset = new TimeSeries( "Herzfrequenz [b/min] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xTime[i], y3Werte[i]); } TimeSeriesCollection dataset1 = new TimeSeriesCollection(dataset); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(2);//, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_Temp.isSelected()) { TimeSeries dataset = new TimeSeries( "Temperatur [C] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xTime[i], y4Werte[i]); } TimeSeriesCollection dataset1 = new TimeSeriesCollection(dataset); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(2);//, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_Steigung_p.isSelected()) { TimeSeries dataset = new TimeSeries("Steigung [%] "); for (i = 0; i < num; i++) { dataset.add(xTime[i], y5Werte[i]); } TimeSeriesCollection dataset1 = new TimeSeriesCollection(dataset); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(2);//, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_Steigung_m.isSelected()) { TimeSeries dataset = new TimeSeries( "Steigung [m/min] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xTime[i], y6Werte[i]); } TimeSeriesCollection dataset1 = new TimeSeriesCollection(dataset); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(2);//, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_av_Geschw.isSelected()) { TimeSeries dataset = new TimeSeries( "av Geschw. [km/h] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xTime[i], y7Werte[i]); } TimeSeriesCollection dataset1 = new TimeSeriesCollection(dataset); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(2);//, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_Cadence.isSelected()) { TimeSeries dataset = new TimeSeries( "Cadence [n/min] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xTime[i], y8Werte[i]); } TimeSeriesCollection dataset1 = new TimeSeriesCollection(dataset); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(2);//, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_Schrittlnge.isSelected()) { TimeSeries dataset = new TimeSeries( "Schrittlnge [cm] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr); for (i = 0; i < num; i++) { dataset.add(xTime[i], y8bWerte[i]); } TimeSeriesCollection dataset1 = new TimeSeriesCollection(dataset); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); XYItemRenderer renderer = new StandardXYItemRenderer(2);//, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } if (JTronicHandle.Graphik_check_Abstand.isSelected() && single == 1 && j != 0) { TimeSeries dataset = new TimeSeries( "Streckenabstand [m] " + JTronicHandle.Statistikhandle.TourData[selected].Tag + "." + JTronicHandle.Statistikhandle.TourData[selected].Monat + "." + JTronicHandle.Statistikhandle.TourData[selected].Jahr + " - " + JTronicHandle.Statistikhandle.TourData[1].Tag + "." + JTronicHandle.Statistikhandle.TourData[1].Monat + "." + JTronicHandle.Statistikhandle.TourData[1].Jahr); for (i = 0; i < num; i++) { dataset.add(xTime[i], y10Werte[i]); } TimeSeriesCollection dataset1 = new TimeSeriesCollection(dataset); ValueAxis axis3 = (ValueAxis) plot.getRangeAxis().clone(); axis3.setLabel("Abstand"); axis3.setLabelPaint(Color.BLACK); axis3.setTickLabelPaint(Color.BLACK); plot.setRangeAxis(2, axis3); plot.setRangeAxisLocation(2, AxisLocation.BOTTOM_OR_RIGHT); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 2); XYItemRenderer renderer = new StandardXYItemRenderer(2);//, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount)); // renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); plot.setRenderer(Linecount, renderer); Linecount++; } } } chart.setNotify(true); ChartPanel Panel = new ChartPanel(chart); return Panel; } catch (Exception e) { JOptionPane.showMessageDialog(null, "StartGraphik\nSchluss_Fehler: " + e, "Achtung!", JOptionPane.ERROR_MESSAGE); } return new ChartPanel(chart); }
From source file:j2se.jfreechart.barchart.BarChartDemo7.java
/** * Creates a sample chart./*from w w w . j av a2 s . c o m*/ * * @param dataset the dataset. * * @return The chart. */ private JFreeChart createChart(final CategoryDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 7", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips? false // URLs? ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final IntervalMarker target = new IntervalMarker(4.5, 7.5); target.setLabel("Target Range"); target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11)); target.setLabelAnchor(RectangleAnchor.LEFT); target.setLabelTextAnchor(TextAnchor.CENTER_LEFT); target.setPaint(new Color(222, 222, 255, 128)); plot.addRangeMarker(target, Layer.BACKGROUND); // set the range axis to display integers only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // disable bar outlines... final BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); renderer.setItemMargin(0.10); // set up gradient paints for series... final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.lightGray); final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray); final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); renderer.setSeriesPaint(2, gp2); // renderer.setLabelGenerator(new BarChartDemo7.LabelGenerator()); renderer.setItemLabelsVisible(true); final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.CENTER_RIGHT, TextAnchor.CENTER_RIGHT, -Math.PI / 2.0); renderer.setPositiveItemLabelPosition(p); final ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.CENTER_LEFT, TextAnchor.CENTER_LEFT, -Math.PI / 2.0); renderer.setPositiveItemLabelPositionFallback(p2); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:jchrest.gui.VisualSearchPane.java
private ChartPanel createPanel() { XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(_trainingTimes);// ww w . ja va 2 s .c o m JFreeChart chart = ChartFactory.createXYLineChart("Plot of network size vs. number of training patterns", "Number of training patterns", "Network size", dataset, org.jfree.chart.plot.PlotOrientation.VERTICAL, true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setDrawSeriesLineAsPath(true); } return new ChartPanel(chart); }
From source file:com.javafxpert.neuralnetviz.scenario.PlotUtil.java
private static JFreeChart createChart(XYZDataset dataset, double[] mins, double[] maxs, int nPoints, XYDataset xyData) {// w w w . j av a 2 s.co m NumberAxis xAxis = new NumberAxis("X"); xAxis.setRange(mins[0], maxs[0]); NumberAxis yAxis = new NumberAxis("Y"); yAxis.setRange(mins[1], maxs[1]); XYBlockRenderer renderer = new XYBlockRenderer(); renderer.setBlockWidth((maxs[0] - mins[0]) / (nPoints - 1)); renderer.setBlockHeight((maxs[1] - mins[1]) / (nPoints - 1)); PaintScale scale = new GrayPaintScale(0, 1.0); renderer.setPaintScale(scale); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5)); JFreeChart chart = new JFreeChart("", plot); chart.getXYPlot().getRenderer().setSeriesVisibleInLegend(0, false); NumberAxis scaleAxis = new NumberAxis("Probability (class 0)"); scaleAxis.setAxisLinePaint(Color.white); scaleAxis.setTickMarkPaint(Color.white); scaleAxis.setTickLabelFont(new Font("Dialog", Font.PLAIN, 7)); PaintScaleLegend legend = new PaintScaleLegend(new GrayPaintScale(), scaleAxis); legend.setStripOutlineVisible(false); legend.setSubdivisionCount(20); legend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT); legend.setAxisOffset(5.0); legend.setMargin(new RectangleInsets(5, 5, 5, 5)); legend.setFrame(new BlockBorder(Color.red)); legend.setPadding(new RectangleInsets(10, 10, 10, 10)); legend.setStripWidth(10); legend.setPosition(RectangleEdge.LEFT); chart.addSubtitle(legend); ChartUtilities.applyCurrentTheme(chart); plot.setDataset(1, xyData); XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(); renderer2.setBaseLinesVisible(false); plot.setRenderer(1, renderer2); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); return chart; }
From source file:edu.utexas.ece.pharos.proteus3.sensors.CompassChartGUI.java
/** * Creates a chart./*from ww w. ja v a 2 s . co m*/ * * @param dataset the data for the chart. * * @return a chart. */ private JFreeChart createChart(final XYDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart("Proteus III Compass Measurements", // chart title "Time (s)", // x axis label "Angle (degrees)", // y axis label dataset, // data PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setDisplaySeriesShapes(true); // get a reference to the plot for further customization... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); final NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setRange(new Range(0, 140)); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); // change the auto tick unit selection to integer units only... // rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); //rangeAxis.setRange(new Range(-Math.PI, Math.PI)); rangeAxis.setRange(new Range(-180, 180)); return chart; }
From source file:org.mars_sim.msp.ui.swing.demo.BarChartDemo7.java
/** * Creates a sample chart./* w w w .j a v a2s. c o m*/ * * @param dataset the dataset. * * @return The chart. */ private JFreeChart createChart(final CategoryDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 7", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips? false // URLs? ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final IntervalMarker target = new IntervalMarker(4.5, 7.5); target.setLabel("Target Range"); target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11)); target.setLabelAnchor(RectangleAnchor.LEFT); target.setLabelTextAnchor(TextAnchor.CENTER_LEFT); target.setPaint(new Color(222, 222, 255, 128)); plot.addRangeMarker(target, Layer.BACKGROUND); // set the range axis to display integers only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // disable bar outlines... final BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); //renderer.setItemMargin(0.10); renderer.setMaximumBarWidth(.5); // set maximum width to 35% of chart // set up gradient paints for series... final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.lightGray); final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray); final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); renderer.setSeriesPaint(2, gp2); // renderer.setLabelGenerator(new BarChartDemo7.LabelGenerator()); renderer.setDefaultItemLabelsVisible(true); final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.CENTER_RIGHT, TextAnchor.CENTER_RIGHT, -Math.PI / 2.0); renderer.setDefaultPositiveItemLabelPosition(p); final ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.CENTER_LEFT, TextAnchor.CENTER_LEFT, -Math.PI / 2.0); renderer.setPositiveItemLabelPositionFallback(p2); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:edu.ucla.stat.SOCR.chart.demo.DifferenceChartDemo1.java
/** * Creates a chart./*www. ja v a 2s . c o m*/ * * @param dataset the dataset. * * @return The chart. */ protected JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart(chartTitle, domainLabel, rangeLabel, dataset, !legendPanelOn, // legend true, // tool tips false // URLs ); chart.setBackgroundPaint(Color.white); XYPlot plot = chart.getXYPlot(); plot.setRenderer(new XYDifferenceRenderer(Color.green, Color.red, false)); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); XYItemRenderer renderer = plot.getRenderer(); renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator()); ValueAxis domainAxis = new DateAxis("Time"); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); plot.setDomainAxis(domainAxis); plot.setForegroundAlpha(0.5f); //setXSummary(dataset) X is time; return chart; }