org.jfree.data.xy.WindDataset Java Examples
The following examples show how to use
org.jfree.data.xy.WindDataset.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChartFactory.java From openstock with GNU General Public License v3.0 | 7 votes |
/** * Creates a wind plot with default settings. * * @param title the chart title (<code>null</code> permitted). * @param xAxisLabel a label for the x-axis (<code>null</code> permitted). * @param yAxisLabel a label for the y-axis (<code>null</code> permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param legend a flag that controls whether or not a legend is created. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A wind plot. * */ public static JFreeChart createWindPlot(String title, String xAxisLabel, String yAxisLabel, WindDataset dataset, boolean legend, boolean tooltips, boolean urls) { ValueAxis xAxis = new DateAxis(xAxisLabel); ValueAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setRange(-12.0, 12.0); WindItemRenderer renderer = new WindItemRenderer(); if (tooltips) { renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); } if (urls) { renderer.setURLGenerator(new StandardXYURLGenerator()); } XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #2
Source File: ChartFactory.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Creates a wind plot with default settings. * * @param title the chart title (<code>null</code> permitted). * @param xAxisLabel a label for the x-axis (<code>null</code> permitted). * @param yAxisLabel a label for the y-axis (<code>null</code> permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param legend a flag that controls whether or not a legend is created. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A wind plot. * */ public static JFreeChart createWindPlot(String title, String xAxisLabel, String yAxisLabel, WindDataset dataset, boolean legend, boolean tooltips, boolean urls) { ValueAxis xAxis = new DateAxis(xAxisLabel); ValueAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setRange(-12.0, 12.0); WindItemRenderer renderer = new WindItemRenderer(); if (tooltips) { renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); } if (urls) { renderer.setURLGenerator(new StandardXYURLGenerator()); } XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #3
Source File: ChartFactory.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates a wind plot with default settings. * * @param title the chart title (<code>null</code> permitted). * @param xAxisLabel a label for the x-axis (<code>null</code> permitted). * @param yAxisLabel a label for the y-axis (<code>null</code> permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param legend a flag that controls whether or not a legend is created. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A wind plot. * */ public static JFreeChart createWindPlot(String title, String xAxisLabel, String yAxisLabel, WindDataset dataset, boolean legend, boolean tooltips, boolean urls) { ValueAxis xAxis = new DateAxis(xAxisLabel); ValueAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setRange(-12.0, 12.0); WindItemRenderer renderer = new WindItemRenderer(); if (tooltips) { renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); } if (urls) { renderer.setURLGenerator(new StandardXYURLGenerator()); } XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #4
Source File: ChartFactory.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Creates a wind plot with default settings. * * @param title the chart title (<code>null</code> permitted). * @param xAxisLabel a label for the x-axis (<code>null</code> permitted). * @param yAxisLabel a label for the y-axis (<code>null</code> permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param legend a flag that controls whether or not a legend is created. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A wind plot. * */ public static JFreeChart createWindPlot(String title, String xAxisLabel, String yAxisLabel, WindDataset dataset, boolean legend, boolean tooltips, boolean urls) { ValueAxis xAxis = new DateAxis(xAxisLabel); ValueAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setRange(-12.0, 12.0); WindItemRenderer renderer = new WindItemRenderer(); if (tooltips) { renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); } if (urls) { renderer.setURLGenerator(new StandardXYURLGenerator()); } XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #5
Source File: ChartFactory.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates a wind plot with default settings. * * @param title the chart title (<code>null</code> permitted). * @param xAxisLabel a label for the x-axis (<code>null</code> permitted). * @param yAxisLabel a label for the y-axis (<code>null</code> permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param legend a flag that controls whether or not a legend is created. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A wind plot. * */ public static JFreeChart createWindPlot(String title, String xAxisLabel, String yAxisLabel, WindDataset dataset, boolean legend, boolean tooltips, boolean urls) { ValueAxis xAxis = new DateAxis(xAxisLabel); ValueAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setRange(-12.0, 12.0); WindItemRenderer renderer = new WindItemRenderer(); if (tooltips) { renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); } if (urls) { renderer.setURLGenerator(new StandardXYURLGenerator()); } XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #6
Source File: ChartFactory.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Creates a wind plot with default settings. * * @param title the chart title (<code>null</code> permitted). * @param xAxisLabel a label for the x-axis (<code>null</code> permitted). * @param yAxisLabel a label for the y-axis (<code>null</code> permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param legend a flag that controls whether or not a legend is created. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A wind plot. * */ public static JFreeChart createWindPlot(String title, String xAxisLabel, String yAxisLabel, WindDataset dataset, boolean legend, boolean tooltips, boolean urls) { ValueAxis xAxis = new DateAxis(xAxisLabel); ValueAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setRange(-12.0, 12.0); WindItemRenderer renderer = new WindItemRenderer(); if (tooltips) { renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); } if (urls) { renderer.setURLGenerator(new StandardXYURLGenerator()); } XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #7
Source File: ChartFactory.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Creates a wind plot with default settings. * * @param title the chart title (<code>null</code> permitted). * @param xAxisLabel a label for the x-axis (<code>null</code> permitted). * @param yAxisLabel a label for the y-axis (<code>null</code> permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param legend a flag that controls whether or not a legend is created. * * @return A wind plot. */ public static JFreeChart createWindPlot(String title, String xAxisLabel, String yAxisLabel, WindDataset dataset, boolean legend) { ValueAxis xAxis = new DateAxis(xAxisLabel); ValueAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setRange(-12.0, 12.0); WindItemRenderer renderer = new WindItemRenderer(); renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #8
Source File: ChartFactory.java From opensim-gui with Apache License 2.0 | 5 votes |
/** * Creates a wind plot with default settings. * * @param title the chart title (<code>null</code> permitted). * @param xAxisLabel a label for the x-axis (<code>null</code> permitted). * @param yAxisLabel a label for the y-axis (<code>null</code> permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param legend a flag that controls whether or not a legend is created. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A wind plot. * */ public static JFreeChart createWindPlot(String title, String xAxisLabel, String yAxisLabel, WindDataset dataset, boolean legend, boolean tooltips, boolean urls) { ValueAxis xAxis = new DateAxis(xAxisLabel); ValueAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setRange(-12.0, 12.0); WindItemRenderer renderer = new WindItemRenderer(); if (tooltips) { renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); } if (urls) { renderer.setURLGenerator(new StandardXYURLGenerator()); } XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); return chart; }
Example #9
Source File: ChartFactory.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Creates a wind plot with default settings. * * @param title the chart title (<code>null</code> permitted). * @param xAxisLabel a label for the x-axis (<code>null</code> permitted). * @param yAxisLabel a label for the y-axis (<code>null</code> permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param legend a flag that controls whether or not a legend is created. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A wind plot. * */ public static JFreeChart createWindPlot(String title, String xAxisLabel, String yAxisLabel, WindDataset dataset, boolean legend, boolean tooltips, boolean urls) { ValueAxis xAxis = new DateAxis(xAxisLabel); ValueAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setRange(-12.0, 12.0); WindItemRenderer renderer = new WindItemRenderer(); if (tooltips) { renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); } if (urls) { renderer.setBaseURLGenerator(new StandardXYURLGenerator()); } XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); return chart; }
Example #10
Source File: WindItemRenderer.java From ECG-Viewer with GNU General Public License v2.0 | 4 votes |
/** * Draws the visual representation of a single data item. * * @param g2 the graphics device. * @param state the renderer state. * @param plotArea the area within which the plot is being drawn. * @param info optional information collection. * @param plot the plot (can be used to obtain standard color * information etc). * @param domainAxis the horizontal axis. * @param rangeAxis the vertical axis. * @param dataset the dataset. * @param series the series index (zero-based). * @param item the item index (zero-based). * @param crosshairState crosshair information for the plot * (<code>null</code> permitted). * @param pass the pass index. */ @Override public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D plotArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) { WindDataset windData = (WindDataset) dataset; Paint seriesPaint = getItemPaint(series, item); Stroke seriesStroke = getItemStroke(series, item); g2.setPaint(seriesPaint); g2.setStroke(seriesStroke); // get the data point... Number x = windData.getX(series, item); Number windDir = windData.getWindDirection(series, item); Number wforce = windData.getWindForce(series, item); double windForce = wforce.doubleValue(); double wdirt = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0); double ax1, ax2, ay1, ay2, rax2, ray2; RectangleEdge domainAxisLocation = plot.getDomainAxisEdge(); RectangleEdge rangeAxisLocation = plot.getRangeAxisEdge(); ax1 = domainAxis.valueToJava2D(x.doubleValue(), plotArea, domainAxisLocation); ay1 = rangeAxis.valueToJava2D(0.0, plotArea, rangeAxisLocation); rax2 = x.doubleValue() + (windForce * Math.cos(wdirt) * 8000000.0); ray2 = windForce * Math.sin(wdirt); ax2 = domainAxis.valueToJava2D(rax2, plotArea, domainAxisLocation); ay2 = rangeAxis.valueToJava2D(ray2, plotArea, rangeAxisLocation); int diri = windDir.intValue(); int forcei = wforce.intValue(); String dirforce = diri + "-" + forcei; Line2D line = new Line2D.Double(ax1, ay1, ax2, ay2); g2.draw(line); g2.setPaint(Color.blue); g2.setFont(new Font("Dialog", 1, 9)); g2.drawString(dirforce, (float) ax1, (float) ay1); g2.setPaint(seriesPaint); g2.setStroke(seriesStroke); double alx2, aly2, arx2, ary2; double ralx2, raly2, rarx2, rary2; double aldir = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0 - 5.0); ralx2 = wforce.doubleValue() * Math.cos(aldir) * 8000000 * 0.8 + x.doubleValue(); raly2 = wforce.doubleValue() * Math.sin(aldir) * 0.8; alx2 = domainAxis.valueToJava2D(ralx2, plotArea, domainAxisLocation); aly2 = rangeAxis.valueToJava2D(raly2, plotArea, rangeAxisLocation); line = new Line2D.Double(alx2, aly2, ax2, ay2); g2.draw(line); double ardir = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0 + 5.0); rarx2 = wforce.doubleValue() * Math.cos(ardir) * 8000000 * 0.8 + x.doubleValue(); rary2 = wforce.doubleValue() * Math.sin(ardir) * 0.8; arx2 = domainAxis.valueToJava2D(rarx2, plotArea, domainAxisLocation); ary2 = rangeAxis.valueToJava2D(rary2, plotArea, rangeAxisLocation); line = new Line2D.Double(arx2, ary2, ax2, ay2); g2.draw(line); }
Example #11
Source File: WindItemRenderer.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * Draws the visual representation of a single data item. * * @param g2 the graphics device. * @param state the renderer state. * @param plotArea the area within which the plot is being drawn. * @param info optional information collection. * @param plot the plot (can be used to obtain standard color * information etc). * @param domainAxis the horizontal axis. * @param rangeAxis the vertical axis. * @param dataset the dataset. * @param series the series index (zero-based). * @param item the item index (zero-based). * @param crosshairState crosshair information for the plot * (<code>null</code> permitted). * @param pass the pass index. */ @Override public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D plotArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) { WindDataset windData = (WindDataset) dataset; Paint seriesPaint = getItemPaint(series, item); Stroke seriesStroke = getItemStroke(series, item); g2.setPaint(seriesPaint); g2.setStroke(seriesStroke); // get the data point... Number x = windData.getX(series, item); Number windDir = windData.getWindDirection(series, item); Number wforce = windData.getWindForce(series, item); double windForce = wforce.doubleValue(); double wdirt = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0); double ax1, ax2, ay1, ay2, rax2, ray2; RectangleEdge domainAxisLocation = plot.getDomainAxisEdge(); RectangleEdge rangeAxisLocation = plot.getRangeAxisEdge(); ax1 = domainAxis.valueToJava2D(x.doubleValue(), plotArea, domainAxisLocation); ay1 = rangeAxis.valueToJava2D(0.0, plotArea, rangeAxisLocation); rax2 = x.doubleValue() + (windForce * Math.cos(wdirt) * 8000000.0); ray2 = windForce * Math.sin(wdirt); ax2 = domainAxis.valueToJava2D(rax2, plotArea, domainAxisLocation); ay2 = rangeAxis.valueToJava2D(ray2, plotArea, rangeAxisLocation); int diri = windDir.intValue(); int forcei = wforce.intValue(); String dirforce = diri + "-" + forcei; Line2D line = new Line2D.Double(ax1, ay1, ax2, ay2); g2.draw(line); g2.setPaint(Color.blue); g2.setFont(new Font("Dialog", 1, 9)); g2.drawString(dirforce, (float) ax1, (float) ay1); g2.setPaint(seriesPaint); g2.setStroke(seriesStroke); double alx2, aly2, arx2, ary2; double ralx2, raly2, rarx2, rary2; double aldir = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0 - 5.0); ralx2 = wforce.doubleValue() * Math.cos(aldir) * 8000000 * 0.8 + x.doubleValue(); raly2 = wforce.doubleValue() * Math.sin(aldir) * 0.8; alx2 = domainAxis.valueToJava2D(ralx2, plotArea, domainAxisLocation); aly2 = rangeAxis.valueToJava2D(raly2, plotArea, rangeAxisLocation); line = new Line2D.Double(alx2, aly2, ax2, ay2); g2.draw(line); double ardir = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0 + 5.0); rarx2 = wforce.doubleValue() * Math.cos(ardir) * 8000000 * 0.8 + x.doubleValue(); rary2 = wforce.doubleValue() * Math.sin(ardir) * 0.8; arx2 = domainAxis.valueToJava2D(rarx2, plotArea, domainAxisLocation); ary2 = rangeAxis.valueToJava2D(rary2, plotArea, rangeAxisLocation); line = new Line2D.Double(arx2, ary2, ax2, ay2); g2.draw(line); }
Example #12
Source File: WindItemRenderer.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * Draws the visual representation of a single data item. * * @param g2 the graphics device. * @param state the renderer state. * @param plotArea the area within which the plot is being drawn. * @param info optional information collection. * @param plot the plot (can be used to obtain standard color * information etc). * @param domainAxis the horizontal axis. * @param rangeAxis the vertical axis. * @param dataset the dataset. * @param series the series index (zero-based). * @param item the item index (zero-based). * @param crosshairState crosshair information for the plot * (<code>null</code> permitted). * @param pass the pass index. */ @Override public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D plotArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) { WindDataset windData = (WindDataset) dataset; Paint seriesPaint = getItemPaint(series, item); Stroke seriesStroke = getItemStroke(series, item); g2.setPaint(seriesPaint); g2.setStroke(seriesStroke); // get the data point... Number x = windData.getX(series, item); Number windDir = windData.getWindDirection(series, item); Number wforce = windData.getWindForce(series, item); double windForce = wforce.doubleValue(); double wdirt = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0); double ax1, ax2, ay1, ay2, rax2, ray2; RectangleEdge domainAxisLocation = plot.getDomainAxisEdge(); RectangleEdge rangeAxisLocation = plot.getRangeAxisEdge(); ax1 = domainAxis.valueToJava2D(x.doubleValue(), plotArea, domainAxisLocation); ay1 = rangeAxis.valueToJava2D(0.0, plotArea, rangeAxisLocation); rax2 = x.doubleValue() + (windForce * Math.cos(wdirt) * 8000000.0); ray2 = windForce * Math.sin(wdirt); ax2 = domainAxis.valueToJava2D(rax2, plotArea, domainAxisLocation); ay2 = rangeAxis.valueToJava2D(ray2, plotArea, rangeAxisLocation); int diri = windDir.intValue(); int forcei = wforce.intValue(); String dirforce = diri + "-" + forcei; Line2D line = new Line2D.Double(ax1, ay1, ax2, ay2); g2.draw(line); g2.setPaint(Color.blue); g2.setFont(new Font("Dialog", 1, 9)); g2.drawString(dirforce, (float) ax1, (float) ay1); g2.setPaint(seriesPaint); g2.setStroke(seriesStroke); double alx2, aly2, arx2, ary2; double ralx2, raly2, rarx2, rary2; double aldir = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0 - 5.0); ralx2 = wforce.doubleValue() * Math.cos(aldir) * 8000000 * 0.8 + x.doubleValue(); raly2 = wforce.doubleValue() * Math.sin(aldir) * 0.8; alx2 = domainAxis.valueToJava2D(ralx2, plotArea, domainAxisLocation); aly2 = rangeAxis.valueToJava2D(raly2, plotArea, rangeAxisLocation); line = new Line2D.Double(alx2, aly2, ax2, ay2); g2.draw(line); double ardir = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0 + 5.0); rarx2 = wforce.doubleValue() * Math.cos(ardir) * 8000000 * 0.8 + x.doubleValue(); rary2 = wforce.doubleValue() * Math.sin(ardir) * 0.8; arx2 = domainAxis.valueToJava2D(rarx2, plotArea, domainAxisLocation); ary2 = rangeAxis.valueToJava2D(rary2, plotArea, rangeAxisLocation); line = new Line2D.Double(arx2, ary2, ax2, ay2); g2.draw(line); }
Example #13
Source File: WindItemRenderer.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Draws the visual representation of a single data item. * * @param g2 the graphics device. * @param state the renderer state. * @param plotArea the area within which the plot is being drawn. * @param plot the plot (can be used to obtain standard color * information etc). * @param domainAxis the horizontal axis. * @param rangeAxis the vertical axis. * @param dataset the dataset. * @param series the series index (zero-based). * @param item the item index (zero-based). * @param pass the pass index. */ public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D plotArea, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, boolean selected, int pass) { WindDataset windData = (WindDataset) dataset; Paint seriesPaint = getItemPaint(series, item, selected); Stroke seriesStroke = getItemStroke(series, item, selected); g2.setPaint(seriesPaint); g2.setStroke(seriesStroke); // get the data point... Number x = windData.getX(series, item); Number windDir = windData.getWindDirection(series, item); Number wforce = windData.getWindForce(series, item); double windForce = wforce.doubleValue(); double wdirt = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0); double ax1, ax2, ay1, ay2, rax2, ray2; RectangleEdge domainAxisLocation = plot.getDomainAxisEdge(); RectangleEdge rangeAxisLocation = plot.getRangeAxisEdge(); ax1 = domainAxis.valueToJava2D(x.doubleValue(), plotArea, domainAxisLocation); ay1 = rangeAxis.valueToJava2D(0.0, plotArea, rangeAxisLocation); rax2 = x.doubleValue() + (windForce * Math.cos(wdirt) * 8000000.0); ray2 = windForce * Math.sin(wdirt); ax2 = domainAxis.valueToJava2D(rax2, plotArea, domainAxisLocation); ay2 = rangeAxis.valueToJava2D(ray2, plotArea, rangeAxisLocation); int diri = windDir.intValue(); int forcei = wforce.intValue(); String dirforce = diri + "-" + forcei; Line2D line = new Line2D.Double(ax1, ay1, ax2, ay2); g2.draw(line); g2.setPaint(Color.blue); g2.setFont(new Font("Tahoma", 1, 9)); g2.drawString(dirforce, (float) ax1, (float) ay1); g2.setPaint(seriesPaint); g2.setStroke(seriesStroke); double alx2, aly2, arx2, ary2; double ralx2, raly2, rarx2, rary2; double aldir = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0 - 5.0); ralx2 = wforce.doubleValue() * Math.cos(aldir) * 8000000 * 0.8 + x.doubleValue(); raly2 = wforce.doubleValue() * Math.sin(aldir) * 0.8; alx2 = domainAxis.valueToJava2D(ralx2, plotArea, domainAxisLocation); aly2 = rangeAxis.valueToJava2D(raly2, plotArea, rangeAxisLocation); line = new Line2D.Double(alx2, aly2, ax2, ay2); g2.draw(line); double ardir = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0 + 5.0); rarx2 = wforce.doubleValue() * Math.cos(ardir) * 8000000 * 0.8 + x.doubleValue(); rary2 = wforce.doubleValue() * Math.sin(ardir) * 0.8; arx2 = domainAxis.valueToJava2D(rarx2, plotArea, domainAxisLocation); ary2 = rangeAxis.valueToJava2D(rary2, plotArea, rangeAxisLocation); line = new Line2D.Double(arx2, ary2, ax2, ay2); g2.draw(line); }
Example #14
Source File: FreeChart.java From NutzCodematic with Apache License 2.0 | 4 votes |
public WindDataset getWindDataset() { return this.vWindDataset; }
Example #15
Source File: WindItemRenderer.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * Draws the visual representation of a single data item. * * @param g2 the graphics device. * @param state the renderer state. * @param plotArea the area within which the plot is being drawn. * @param info optional information collection. * @param plot the plot (can be used to obtain standard color * information etc). * @param domainAxis the horizontal axis. * @param rangeAxis the vertical axis. * @param dataset the dataset. * @param series the series index (zero-based). * @param item the item index (zero-based). * @param crosshairState crosshair information for the plot * (<code>null</code> permitted). * @param pass the pass index. */ @Override public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D plotArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) { WindDataset windData = (WindDataset) dataset; Paint seriesPaint = getItemPaint(series, item); Stroke seriesStroke = getItemStroke(series, item); g2.setPaint(seriesPaint); g2.setStroke(seriesStroke); // get the data point... Number x = windData.getX(series, item); Number windDir = windData.getWindDirection(series, item); Number wforce = windData.getWindForce(series, item); double windForce = wforce.doubleValue(); double wdirt = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0); double ax1, ax2, ay1, ay2, rax2, ray2; RectangleEdge domainAxisLocation = plot.getDomainAxisEdge(); RectangleEdge rangeAxisLocation = plot.getRangeAxisEdge(); ax1 = domainAxis.valueToJava2D(x.doubleValue(), plotArea, domainAxisLocation); ay1 = rangeAxis.valueToJava2D(0.0, plotArea, rangeAxisLocation); rax2 = x.doubleValue() + (windForce * Math.cos(wdirt) * 8000000.0); ray2 = windForce * Math.sin(wdirt); ax2 = domainAxis.valueToJava2D(rax2, plotArea, domainAxisLocation); ay2 = rangeAxis.valueToJava2D(ray2, plotArea, rangeAxisLocation); int diri = windDir.intValue(); int forcei = wforce.intValue(); String dirforce = diri + "-" + forcei; Line2D line = new Line2D.Double(ax1, ay1, ax2, ay2); g2.draw(line); g2.setPaint(Color.blue); g2.setFont(new Font("Dialog", 1, 9)); g2.drawString(dirforce, (float) ax1, (float) ay1); g2.setPaint(seriesPaint); g2.setStroke(seriesStroke); double alx2, aly2, arx2, ary2; double ralx2, raly2, rarx2, rary2; double aldir = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0 - 5.0); ralx2 = wforce.doubleValue() * Math.cos(aldir) * 8000000 * 0.8 + x.doubleValue(); raly2 = wforce.doubleValue() * Math.sin(aldir) * 0.8; alx2 = domainAxis.valueToJava2D(ralx2, plotArea, domainAxisLocation); aly2 = rangeAxis.valueToJava2D(raly2, plotArea, rangeAxisLocation); line = new Line2D.Double(alx2, aly2, ax2, ay2); g2.draw(line); double ardir = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0 + 5.0); rarx2 = wforce.doubleValue() * Math.cos(ardir) * 8000000 * 0.8 + x.doubleValue(); rary2 = wforce.doubleValue() * Math.sin(ardir) * 0.8; arx2 = domainAxis.valueToJava2D(rarx2, plotArea, domainAxisLocation); ary2 = rangeAxis.valueToJava2D(rary2, plotArea, rangeAxisLocation); line = new Line2D.Double(arx2, ary2, ax2, ay2); g2.draw(line); }
Example #16
Source File: WindItemRenderer.java From ccu-historian with GNU General Public License v3.0 | 4 votes |
/** * Draws the visual representation of a single data item. * * @param g2 the graphics device. * @param state the renderer state. * @param plotArea the area within which the plot is being drawn. * @param info optional information collection. * @param plot the plot (can be used to obtain standard color * information etc). * @param domainAxis the horizontal axis. * @param rangeAxis the vertical axis. * @param dataset the dataset. * @param series the series index (zero-based). * @param item the item index (zero-based). * @param crosshairState crosshair information for the plot * (<code>null</code> permitted). * @param pass the pass index. */ @Override public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D plotArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) { WindDataset windData = (WindDataset) dataset; Paint seriesPaint = getItemPaint(series, item); Stroke seriesStroke = getItemStroke(series, item); g2.setPaint(seriesPaint); g2.setStroke(seriesStroke); // get the data point... Number x = windData.getX(series, item); Number windDir = windData.getWindDirection(series, item); Number wforce = windData.getWindForce(series, item); double windForce = wforce.doubleValue(); double wdirt = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0); double ax1, ax2, ay1, ay2, rax2, ray2; RectangleEdge domainAxisLocation = plot.getDomainAxisEdge(); RectangleEdge rangeAxisLocation = plot.getRangeAxisEdge(); ax1 = domainAxis.valueToJava2D(x.doubleValue(), plotArea, domainAxisLocation); ay1 = rangeAxis.valueToJava2D(0.0, plotArea, rangeAxisLocation); rax2 = x.doubleValue() + (windForce * Math.cos(wdirt) * 8000000.0); ray2 = windForce * Math.sin(wdirt); ax2 = domainAxis.valueToJava2D(rax2, plotArea, domainAxisLocation); ay2 = rangeAxis.valueToJava2D(ray2, plotArea, rangeAxisLocation); int diri = windDir.intValue(); int forcei = wforce.intValue(); String dirforce = diri + "-" + forcei; Line2D line = new Line2D.Double(ax1, ay1, ax2, ay2); g2.draw(line); g2.setPaint(Color.blue); g2.setFont(new Font("Dialog", 1, 9)); g2.drawString(dirforce, (float) ax1, (float) ay1); g2.setPaint(seriesPaint); g2.setStroke(seriesStroke); double alx2, aly2, arx2, ary2; double ralx2, raly2, rarx2, rary2; double aldir = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0 - 5.0); ralx2 = wforce.doubleValue() * Math.cos(aldir) * 8000000 * 0.8 + x.doubleValue(); raly2 = wforce.doubleValue() * Math.sin(aldir) * 0.8; alx2 = domainAxis.valueToJava2D(ralx2, plotArea, domainAxisLocation); aly2 = rangeAxis.valueToJava2D(raly2, plotArea, rangeAxisLocation); line = new Line2D.Double(alx2, aly2, ax2, ay2); g2.draw(line); double ardir = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0 + 5.0); rarx2 = wforce.doubleValue() * Math.cos(ardir) * 8000000 * 0.8 + x.doubleValue(); rary2 = wforce.doubleValue() * Math.sin(ardir) * 0.8; arx2 = domainAxis.valueToJava2D(rarx2, plotArea, domainAxisLocation); ary2 = rangeAxis.valueToJava2D(rary2, plotArea, rangeAxisLocation); line = new Line2D.Double(arx2, ary2, ax2, ay2); g2.draw(line); }
Example #17
Source File: WindItemRenderer.java From openstock with GNU General Public License v3.0 | 4 votes |
/** * Draws the visual representation of a single data item. * * @param g2 the graphics device. * @param state the renderer state. * @param plotArea the area within which the plot is being drawn. * @param info optional information collection. * @param plot the plot (can be used to obtain standard color * information etc). * @param domainAxis the horizontal axis. * @param rangeAxis the vertical axis. * @param dataset the dataset. * @param series the series index (zero-based). * @param item the item index (zero-based). * @param crosshairState crosshair information for the plot * (<code>null</code> permitted). * @param pass the pass index. */ @Override public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D plotArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) { WindDataset windData = (WindDataset) dataset; Paint seriesPaint = getItemPaint(series, item); Stroke seriesStroke = getItemStroke(series, item); g2.setPaint(seriesPaint); g2.setStroke(seriesStroke); // get the data point... Number x = windData.getX(series, item); Number windDir = windData.getWindDirection(series, item); Number wforce = windData.getWindForce(series, item); double windForce = wforce.doubleValue(); double wdirt = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0); double ax1, ax2, ay1, ay2, rax2, ray2; RectangleEdge domainAxisLocation = plot.getDomainAxisEdge(); RectangleEdge rangeAxisLocation = plot.getRangeAxisEdge(); ax1 = domainAxis.valueToJava2D(x.doubleValue(), plotArea, domainAxisLocation); ay1 = rangeAxis.valueToJava2D(0.0, plotArea, rangeAxisLocation); rax2 = x.doubleValue() + (windForce * Math.cos(wdirt) * 8000000.0); ray2 = windForce * Math.sin(wdirt); ax2 = domainAxis.valueToJava2D(rax2, plotArea, domainAxisLocation); ay2 = rangeAxis.valueToJava2D(ray2, plotArea, rangeAxisLocation); int diri = windDir.intValue(); int forcei = wforce.intValue(); String dirforce = diri + "-" + forcei; Line2D line = new Line2D.Double(ax1, ay1, ax2, ay2); g2.draw(line); g2.setPaint(Color.blue); g2.setFont(new Font("Dialog", 1, 9)); g2.drawString(dirforce, (float) ax1, (float) ay1); g2.setPaint(seriesPaint); g2.setStroke(seriesStroke); double alx2, aly2, arx2, ary2; double ralx2, raly2, rarx2, rary2; double aldir = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0 - 5.0); ralx2 = wforce.doubleValue() * Math.cos(aldir) * 8000000 * 0.8 + x.doubleValue(); raly2 = wforce.doubleValue() * Math.sin(aldir) * 0.8; alx2 = domainAxis.valueToJava2D(ralx2, plotArea, domainAxisLocation); aly2 = rangeAxis.valueToJava2D(raly2, plotArea, rangeAxisLocation); line = new Line2D.Double(alx2, aly2, ax2, ay2); g2.draw(line); double ardir = Math.toRadians(windDir.doubleValue() * (-30.0) - 90.0 + 5.0); rarx2 = wforce.doubleValue() * Math.cos(ardir) * 8000000 * 0.8 + x.doubleValue(); rary2 = wforce.doubleValue() * Math.sin(ardir) * 0.8; arx2 = domainAxis.valueToJava2D(rarx2, plotArea, domainAxisLocation); ary2 = rangeAxis.valueToJava2D(rary2, plotArea, rangeAxisLocation); line = new Line2D.Double(arx2, ary2, ax2, ay2); g2.draw(line); }