private JFreeChart buildDifferenceChart(TimeSeriesCollection dataset, String title) { // Creat the chart JFreeChart chart = ChartFactory.createTimeSeriesChart( title, "Date", "Price", dataset, true, // legend true, // tool tips false // URLs ); chart.setBackgroundPaint(Color.white); XYPlot plot = chart.getXYPlot(); plot.setRenderer( new XYDifferenceRenderer(new Color(112, 128, 222), new Color(112, 128, 222), false)); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(UnitType.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); ValueAxis domainAxis = new DateAxis("Date"); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); plot.setDomainAxis(domainAxis); plot.setForegroundAlpha(0.5f); return chart; }
private JFreeChart buildChart(TimeSeriesCollection dataset, String title, boolean endPoints) { // Create the chart JFreeChart chart = ChartFactory.createTimeSeriesChart(title, "Date", "Price", dataset, true, true, false); // Display each series in the chart with its point shape in the legend LegendTitle sl = chart.getLegend(); // sl.setDisplaySeriesShapes(true); // Setup the appearance of the chart chart.setBackgroundPaint(Color.white); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(UnitType.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); // Display data points or just the lines? if (endPoints) { XYItemRenderer renderer = plot.getRenderer(); if (renderer instanceof StandardXYItemRenderer) { StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer; // rr.setPlotShapes(true); rr.setShapesFilled(true); rr.setItemLabelsVisible(true); } } // Tell the chart how we would like dates to read DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy")); return chart; }
private static JFreeChart createChart() { DateAxis dateaxis = new DateAxis("Date"); dateaxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); NumberAxis numberaxis = new NumberAxis("Value"); IntervalXYDataset intervalxydataset = createDataset1(); XYBarRenderer xybarrenderer = new XYBarRenderer(0.20000000000000001D); xybarrenderer.setBaseToolTipGenerator( new StandardXYToolTipGenerator( "{0}: ({1}, {2})", new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00"))); XYPlot xyplot = new XYPlot(intervalxydataset, dateaxis, numberaxis, xybarrenderer); NumberAxis numberaxis1 = new NumberAxis("Value 2"); xyplot.setRangeAxis(1, numberaxis1); XYDataset xydataset = createDataset2A(); StandardXYItemRenderer standardxyitemrenderer = new StandardXYItemRenderer(); standardxyitemrenderer.setBaseToolTipGenerator( new StandardXYToolTipGenerator( "{0}: ({1}, {2})", new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00"))); xyplot.setDataset(1, xydataset); xyplot.setRenderer(1, standardxyitemrenderer); XYDataset xydataset1 = createDataset2B(); xyplot.setDataset(2, xydataset1); xyplot.setRenderer(2, new StandardXYItemRenderer()); xyplot.mapDatasetToRangeAxis(2, 1); xyplot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); xyplot.setOrientation(PlotOrientation.VERTICAL); JFreeChart jfreechart = new JFreeChart("Overlaid XYPlot Demo 2", JFreeChart.DEFAULT_TITLE_FONT, xyplot, true); ChartUtilities.applyCurrentTheme(jfreechart); return jfreechart; }
/** * temporal helper function * * @param dataset * @return */ private JFreeChart createChart(TimeSeriesCollection dataset) { NumberAxis axis = new NumberAxis(null); axis.setAutoRangeIncludesZero(false); // parent=new CombinedRangeXYPlot(axis); // chart = null; // XYPlot plot2=new XYPlot(dataset2, new DateAxis(null), null, new StandardXYItemRenderer()); // XYPlot subplot2=new XYPldt(dataset2, new DateAxis("Date 2"), null, ) // parent.add(subplot1); // parent.add(subplot2); // chart=new JFreeChart(null, null, parent, false); chart = ChartFactory.createTimeSeriesChart(null, "", "", dataset, false, false, false); XYPlot plot1 = chart.getXYPlot(); plot1.setDataset(dataset); plot1.setRenderer(new StandardXYItemRenderer()); plot1.setSecondaryDataset(0, hld); CandlestickRenderer c1 = new CandlestickRenderer(); // c1.setAutoWidthFactor(1.0); // c1.setAutoWidthGap(0.1); c1.setBasePaint(new Color(255, 255, 255)); c1.setBaseOutlinePaint(new Color(255, 255, 255)); c1.setPaint(new Color(255, 255, 255)); c1.setUpPaint(new Color(255, 0, 0, 80)); c1.setDownPaint(new Color(0, 255, 0, 80)); plot1.setSecondaryRenderer(0, c1); // plot1.setSecondaryDataset(0, dataset2); XYDotRenderer xd1 = new XYDotRenderer(); // plot1.setSecondaryRenderer(0, new AreaXYRenderer(AreaXYRenderer.AREA_AND_SHAPES)); // plot1.setSecondaryRenderer(0, xd1); // chart=new JFreeChart("", null, plot1, false); chart.setBackgroundPaint(new Color(0, 0, 0)); return chart; }
public Chart(String title, String timeAxis, String valueAxis, TimeSeries data) { try { // Build the datasets dataset.addSeries(data); // Create the chart JFreeChart chart = ChartFactory.createTimeSeriesChart( title, timeAxis, valueAxis, dataset, true, true, false); // Setup the appearance of the chart chart.setBackgroundPaint(Color.white); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(UnitType.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); // Tell the chart how we would like dates to read DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("EEE HH")); this.add(new ChartPanel(chart)); } catch (Exception e) { e.printStackTrace(); } }
private static JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createXYLineChart( "Ratings by Age", // Title "Age", // X label "Average Rating", // Y label dataset, // data PlotOrientation.VERTICAL, // Orientation false, // legend false, // tooltips false); // urls chart.setBorderPaint(Color.white); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, true); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return chart; }
/** Creates fundamental diagram chart. */ private JFreeChart makeFDChart() { updateFDSeries(); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(ffFD); dataset.addSeries(cFD); dataset.addSeries(cdFD); JFreeChart chart = ChartFactory.createXYLineChart( null, // chart title "Density (vpm)", // x axis label "Flow (vph)", // y axis label dataset, // data PlotOrientation.VERTICAL, false, // include legend false, // tooltips false // urls ); XYPlot plot = (XYPlot) chart.getPlot(); plot.getRenderer().setSeriesPaint(0, Color.GREEN); plot.getRenderer().setSeriesPaint(1, Color.RED); plot.getRenderer().setSeriesPaint(2, Color.BLUE); plot.getRenderer().setStroke(new BasicStroke(2)); return chart; }
/** * Create the charts * * @throws RemoteException On badness * @throws VisADException On badness */ public void loadData() throws VisADException, RemoteException { createChart(); List dataChoiceWrappers = getDataChoiceWrappers(); try { for (int dataSetIdx = 0; dataSetIdx < plot.getDatasetCount(); dataSetIdx++) { MyHistogramDataset dataset = (MyHistogramDataset) plot.getDataset(dataSetIdx); dataset.removeAllSeries(); } // dataset.removeAllSeries(); Hashtable props = new Hashtable(); props.put(TrackDataSource.PROP_TRACKTYPE, TrackDataSource.ID_TIMETRACE); for (int paramIdx = 0; paramIdx < dataChoiceWrappers.size(); paramIdx++) { DataChoiceWrapper wrapper = (DataChoiceWrapper) dataChoiceWrappers.get(paramIdx); DataChoice dataChoice = wrapper.getDataChoice(); FlatField data = getFlatField((FieldImpl) dataChoice.getData(null, props)); Unit unit = ucar.visad.Util.getDefaultRangeUnits((FlatField) data)[0]; double[][] samples = data.getValues(false); double[] actualValues = filterData(samples[0], getTimeValues(samples, data))[0]; NumberAxis domainAxis = new NumberAxis(wrapper.getLabel(unit)); XYItemRenderer renderer; if (stacked) { renderer = new StackedXYBarRenderer(); } else { renderer = new XYBarRenderer(); } plot.setRenderer(paramIdx, renderer); Color c = wrapper.getColor(paramIdx); domainAxis.setLabelPaint(c); renderer.setSeriesPaint(0, c); MyHistogramDataset dataset = new MyHistogramDataset(); dataset.setType(HistogramType.FREQUENCY); dataset.addSeries(dataChoice.getName() + " [" + unit + "]", actualValues, bins); plot.setDomainAxis(paramIdx, domainAxis, false); plot.mapDatasetToDomainAxis(paramIdx, paramIdx); plot.setDataset(paramIdx, dataset); } } catch (Exception exc) { LogUtil.logException("Error creating data set", exc); return; } }
public String generateXYAreaChart( HttpSession session, PrintWriter pw, String courseId, int studentId) { String filename = null; /* int groupId=0; if (groupName.equals("All")){ groupId=0; }else{ groupId = studStatisticBean.getGroupIdByName(groupName); }*/ try { // Retrieve list of WebHits for each section and populate a TableXYDataset StudentsConceptChartDataSet cDataSet = new StudentsConceptChartDataSet(studStatisticBean, courseId, studentId); // cDataSet.setStudentStatisticBeanIdRef(studStatisticBean); ArrayList sections = cDataSet.getSections(); Iterator sectionIter = sections.iterator(); DefaultTableXYDataset dataset = new DefaultTableXYDataset(); while (sectionIter.hasNext()) { String section = (String) sectionIter.next(); ArrayList list = cDataSet.getDataByHitConcept(section); XYSeries dataSeries = new XYSeries(section, true, false); Iterator webHitIter = list.iterator(); while (webHitIter.hasNext()) { StudentsConceptHit cHit = (StudentsConceptHit) webHitIter.next(); dataSeries.add(cHit.getOrdNumb(), cHit.getHitDegree()); } dataset.addSeries(dataSeries); } // Throw a custom NoDataException if there is no data if (dataset.getItemCount() == 0) { System.out.println("No data has been found"); throw new NoDataException(); } // Create tooltip and URL generators SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy", Locale.UK); StandardXYToolTipGenerator ttg = new StandardXYToolTipGenerator( StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, sdf, NumberFormat.getInstance()); TimeSeriesURLGenerator urlg = new TimeSeriesURLGenerator(sdf, "bar_chart.jsp", "series", "hitDate"); // Create the X-Axis DateAxis xAxis = new DateAxis(null); xAxis.setLowerMargin(0.0); xAxis.setUpperMargin(0.0); // Create the X-Axis NumberAxis yAxis = new NumberAxis(null); yAxis.setAutoRangeIncludesZero(true); // Create the renderer StackedXYAreaRenderer renderer = new StackedXYAreaRenderer(XYAreaRenderer.AREA_AND_SHAPES, ttg, urlg); renderer.setSeriesPaint(0, new Color(255, 255, 180)); renderer.setSeriesPaint(1, new Color(206, 230, 255)); renderer.setSeriesPaint(2, new Color(255, 230, 230)); renderer.setSeriesPaint(3, new Color(206, 255, 206)); renderer.setShapePaint(Color.gray); renderer.setShapeStroke(new BasicStroke(0.5f)); renderer.setShape(new Ellipse2D.Double(-3, -3, 6, 6)); renderer.setOutline(true); // Create the plot XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setForegroundAlpha(0.65f); // Reconfigure Y-Axis so the auto-range knows that the data is stacked yAxis.configure(); // Create the chart JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, true); chart.setBackgroundPaint(java.awt.Color.white); // Write the chart image to the temporary directory ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); filename = ServletUtilities.saveChartAsPNG(chart, 600, 400, info, session); // Write the image map to the PrintWriter ChartUtilities.writeImageMap(pw, filename, info); pw.flush(); } catch (NoDataException e) { System.out.println(e.toString()); filename = "public_nodata_500x300.png"; } catch (Exception e) { System.out.println("Exception - " + e.toString()); e.printStackTrace(System.out); filename = "public_error_500x300.png"; } return filename; }
public String generateXYChart( String section, HttpSession session, PrintWriter pw, String courseId, int studentId) { /*int groupId=0; if (groupName.equals("All")){ groupId=0; }else{ groupId = studStatisticBean.getGroupIdByName(groupName); }*/ String filename = null; try { // Retrieve list of WebHits StudentsConceptChartDataSet cDataSet = new StudentsConceptChartDataSet(studStatisticBean, courseId, studentId); ArrayList list = cDataSet.getDataByHitConcept(section); // Throw a custom NoDataException if there is no data if (list.size() == 0) { System.out.println("No data has been found"); throw new NoDataException(); } // Create and populate an XYSeries Collection XYSeries dataSeries = new XYSeries("Students progress line"); Iterator iter = list.listIterator(); while (iter.hasNext()) { StudentsConceptHit ch = (StudentsConceptHit) iter.next(); dataSeries.add(ch.getOrdNumb(), ch.getHitDegree()); } XYSeriesCollection xyDataset = new XYSeriesCollection(dataSeries); NumberFormat nf = NumberFormat.getIntegerInstance(); NumberFormat nf2 = NumberFormat.getInstance(); String cTitle = null; // StandardXYToolTipGenerator ttg = new // StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,nf,nf2); CustomXYToolTipGenerator ttg = new CustomXYToolTipGenerator(); ttg.addToolTipSeries(cDataSet.getConceptNames()); StandardXYURLGenerator sxyUrlGen = new StandardXYURLGenerator("#", xyDataset.getSeriesName(0), "PassedConceptOrdNum"); ValueAxis ordNumAxis = new NumberAxis("Concept ordinal number"); NumberAxis valueAxis = new NumberAxis("Current knowledge"); // valueAxis.setAutoRangeIncludesZero(true); valueAxis.setRange(0.0, 6.0); // override default ordNumAxis.setAutoRange(true); ordNumAxis.setLowerMargin(0.0); StandardXYItemRenderer renderer = new StandardXYItemRenderer( StandardXYItemRenderer.LINES + StandardXYItemRenderer.SHAPES, ttg, sxyUrlGen); Marker marker = new ValueMarker(1.50); // / Marker marker2 = new ValueMarker(2.50); Marker marker3 = new ValueMarker(3.50); Marker marker4 = new ValueMarker(4.50); Marker marker5 = new ValueMarker(5.00); renderer.setShapesFilled(true); XYPlot plot = new XYPlot(xyDataset, ordNumAxis, valueAxis, renderer); plot.addRangeMarker(marker); plot.addRangeMarker(marker2); plot.addRangeMarker(marker3); plot.addRangeMarker(marker4); plot.addRangeMarker(marker5); XYTextAnnotation xyBad = new XYTextAnnotation("Bad", 1, 1); xyBad.setX(0.2); xyBad.setY(0.75); XYTextAnnotation xyNotBad = new XYTextAnnotation("Not Bad", 1, 1); xyNotBad.setX(0.2); xyNotBad.setY(2); XYTextAnnotation xyGood = new XYTextAnnotation("Good", 1, 1); xyGood.setX(0.2); xyGood.setY(3); XYTextAnnotation xyVeryGood = new XYTextAnnotation("Very Good", 1, 1); xyVeryGood.setX(0.2); xyVeryGood.setY(4); XYTextAnnotation xyExcellent = new XYTextAnnotation("Excellent", 1, 1); xyExcellent.setX(0.2); xyExcellent.setY(4.75); XYTextAnnotation xyExpert = new XYTextAnnotation("Expert", 1, 1); xyExpert.setX(0.2); xyExpert.setY(5.25); plot.addAnnotation(xyBad); plot.addAnnotation(xyNotBad); plot.addAnnotation(xyGood); plot.addAnnotation(xyVeryGood); plot.addAnnotation(xyExcellent); plot.addAnnotation(xyExpert); JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true); chart.setBackgroundPaint(java.awt.Color.white); // Write the chart image to the temporary directory ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); filename = ServletUtilities.saveChartAsPNG(chart, 600, 400, info, session); // Write the image map to the PrintWriter ChartUtilities.writeImageMap(pw, filename, info); pw.flush(); } catch (NoDataException e) { System.out.println(e.toString()); filename = "public_nodata_500x300.png"; } catch (Exception e) { System.out.println("Exception - " + e.toString()); e.printStackTrace(System.out); filename = "public_error_500x300.png"; } return filename; }
private void addData( JFreeChart chart, DSLAMSource source, Timeinterval time, Serializable filter, Properties properties, Map<String, Object> colorScheme, Properties outputProperties) throws IOException { if (chart != null) { PerformanceCounterDataCollection cData = null; long dataSize = 0; try { cData = getPerformanceCounterDataCollection(source, time, filter, properties, outputProperties); Collection<PerformanceCounterData> data = null; Date d0 = null; // first timestamp for data Date d1 = null; // last timestamp for data RegularTimePeriod time0 = null; if (cData != null) { data = cData.getData(); { int l = data.size(); outputProperties.setProperty("data.count", Integer.toString(l)); } if (data != null && data.size() > 0) { dataSize = data.size(); // Set 'd0': { // TODO: Avoid assumption "data is sorted"! PerformanceCounterData e = data.iterator().next(); d0 = e.getTimestamp(); } // Set 'd1': { // TODO: Avoid assumption "data is sorted"! for (PerformanceCounterData e : data) { d1 = e.getTimestamp(); } } time0 = createRegularTimePeriod(d0); } } XYPlot plot = chart.getXYPlot(); // Set the first dataset: { TimeSeriesCollection dataset = new TimeSeriesCollection(); List<Paint> seriesPaint = new ArrayList<Paint>(); List<Stroke> seriesStroke = new ArrayList<Stroke>(); // Add series 'ES': { if (data != null && data.size() > 0) { TimeSeries series = new TimeSeries("ES", time0.getClass()); for (PerformanceCounterData e : data) { Date d = e.getTimestamp(); RegularTimePeriod timePeriod = createRegularTimePeriod(d); // Add point: { int value = getES(e); addOrUpdate(series, timePeriod, (double) value); } } seriesPaint.add((Paint) colorScheme.get("color.counter.es")); seriesStroke.add(STROKE_COUNTER_ES); dataset.addSeries(series); } } // Add series 'SES': { if (data != null && data.size() > 0) { TimeSeries series = new TimeSeries("SES", time0.getClass()); for (PerformanceCounterData e : data) { Date d = e.getTimestamp(); RegularTimePeriod timePeriod = createRegularTimePeriod(d); // Add point: { int value = getSES(e); addOrUpdate(series, timePeriod, (double) value); } } seriesPaint.add((Paint) colorScheme.get("color.counter.ses")); seriesStroke.add(STROKE_COUNTER_SES); dataset.addSeries(series); } } // Add series 'US': { if (data != null && data.size() > 0) { TimeSeries series = new TimeSeries("US", time0.getClass()); for (PerformanceCounterData e : data) { Date d = e.getTimestamp(); RegularTimePeriod timePeriod = createRegularTimePeriod(d); // Add point: { int value = getUS(e); addOrUpdate(series, timePeriod, (double) value); } } seriesPaint.add((Paint) colorScheme.get("color.counter.us")); seriesStroke.add(STROKE_COUNTER_US); dataset.addSeries(series); } } // superspeed { if (data != null && data.size() > 0) { TimeSeries series = new TimeSeries("LEFTRS", time0.getClass()); for (PerformanceCounterData e : data) { Date d = e.getTimestamp(); RegularTimePeriod timePeriod = createRegularTimePeriod(d); { int value = getPreviousLEFTRS(e); addOrUpdate(series, timePeriod, (double) value); } } seriesPaint.add((Paint) colorScheme.get("color.counter.previousleftrs")); seriesStroke.add(STROKE_COUNTER_US); dataset.addSeries(series); } } // ends { if (data != null && data.size() > 0) { boolean showLinearCurve = getShowLinearCurve(); if (showLinearCurve) { // Add series for a linear curve: { TimeSeries series = new TimeSeries("Linear", time0.getClass()); long t0 = d0.getTime(); long t1 = d1.getTime(); if (t0 < t1) { long timeX = 15 * 60 * 1000; // 15 minutes intervals // TODO: Read length of intervals from obtained data! double value0 = 0; double value1 = 900; // TODO: Read '900' from obtained data! long timeDelta = t1 - t0; double valueDelta = value1 - value0; long t = t0; int i = 0; while (t <= t1) { Date d = new Date(t); RegularTimePeriod timePeriod = createRegularTimePeriod(d); double value = value0 + ((t - t0) * valueDelta) / timeDelta; // Add point: { addOrUpdate(series, timePeriod, (double) value); } t += timeX; i += 1; } } seriesPaint.add(Color.red); seriesStroke.add(STROKE_COUNTER_DEFAULT); dataset.addSeries(series); } } } } setDefaultRenderer(chart, colorScheme, 0, seriesPaint, seriesStroke); plot.setDataset(0, dataset); plot.mapDatasetToRangeAxis(0, 0); } } finally { if (cData != null) { cData.dispose(); cData = null; } } if (outputProperties != null) { outputProperties.setProperty("data.count", Long.toString(dataSize)); } } }
protected JFreeChart createChart( DSLAMSource source, String LID, Timeinterval time, Properties properties, GraphRenderingInput input, Map<String, Object> colorScheme, Properties outputProperties) throws IOException { JFreeChart res = null; { JFreeChart chart = null; Timeinterval domainAxisTime = null; // Set 'chart': { String domainAxisTitle = null; // Set 'domainAxisTime': { DateFormat format = (DateFormat) colorScheme.get("date.format"); domainAxisTitle = "Time (" + time.toString(format) + ")"; } chart = ChartFactory.createTimeSeriesChart( null, // chart-title domainAxisTitle, // domain-axis label null, // value-axis label null, // dataset true, // legends required true, // generate tooltips false // generate URLs ); } XYPlot plot = chart.getXYPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.getRangeAxis().setFixedDimension(15.0); // Fix the domain axis: { fixDateAxisToTimeinterval(plot, time); domainAxisTime = time; } // Set the y-axis: { String axisTitle = "Count (/900s)"; ValueAxis a = new LogarithmicAxis(axisTitle); a.setLowerBound(0); a.setUpperBound(1000); // TODO: '1000' is '900' rounded up to nearest power of 10! // TODO: Get unit from data-model! // TODO: Get upper bound from data-model! plot.setRangeAxis(a); } String title = getTitle(); setDefaults(chart, colorScheme); setTitle(chart, LID, colorScheme, title, source, time); String filter = ""; // an empty string implies the default filter! // Set 'filter': { if (input != null) { Properties p = input.getProperties(); if (p != null) { String v = p.getProperty("data.filter"); if (v != null) { filter = v; } } } } addData(chart, source, time, filter, properties, colorScheme, outputProperties); if (outputProperties != null) { if (domainAxisTime != null) { outputProperties.setProperty("axis.domain.time", time.toString()); } } res = chart; } return res; }
public ValueAxis getValueAxisCandles() { CombinedDomainXYPlot cplot = (CombinedDomainXYPlot) this.getChart().getPlot(); XYPlot plot = (XYPlot) cplot.getSubplots().get(0); ValueAxis va = plot.getRangeAxis(); return va; }