List of usage examples for org.jfree.chart ChartFactory setChartTheme
public static void setChartTheme(ChartTheme theme)
From source file:ec.nbdemetra.ui.demo.ComponentsDemo.java
private static void initStaticResources() { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); BarRenderer.setDefaultBarPainter(new StandardBarPainter()); UIManager.put("Nb.Editor.Toolbar.border", BorderFactory.createLineBorder(Color.WHITE)); TsFactory.instance.add(new FakeTsProvider()); }
From source file:canreg.client.analysis.CasesByAgeGroupChartTableBuilder.java
public CasesByAgeGroupChartTableBuilder() { ChartTheme chartTheme = new StandardChartTheme("sansserif"); ChartFactory.setChartTheme(chartTheme); }
From source file:entropy.plan.visualization.GanttVisualizer.java
/** * Build the plan agenda/* w w w .jav a 2s .c om*/ * * @param plan the plan to visualize * @return {@code true} if the generation succeeds */ @Override public boolean buildVisualization(TimedReconfigurationPlan plan) { File parent = new File(out).getParentFile(); if (parent != null && !parent.exists() && !parent.mkdirs()) { Plan.logger.error("Unable to create '" + out + "'"); return false; } final TaskSeriesCollection collection = new TaskSeriesCollection(); TaskSeries ts = new TaskSeries("actions"); for (Action action : plan) { Task t = new Task(action.toString(), new SimpleTimePeriod(action.getStartMoment(), action.getFinishMoment())); ts.add(t); } collection.add(ts); ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); final JFreeChart chart = ChartFactory.createGanttChart(null, // chart title "Actions", // domain axis label "Time", // range axis label collection, // data false, // include legend true, // tooltips false // urls ); CategoryPlot plot = chart.getCategoryPlot(); DateAxis da = (DateAxis) plot.getRangeAxis(); SimpleDateFormat sdfmt = new SimpleDateFormat(); sdfmt.applyPattern("S"); da.setDateFormatOverride(sdfmt); ((GanttRenderer) plot.getRenderer()).setShadowVisible(false); int width = 500 + 10 * plan.getDuration(); int height = 50 + 20 * plan.size(); try { switch (fmt) { case png: ChartUtilities.saveChartAsPNG(new File(out), chart, width, height); break; case jpg: ChartUtilities.saveChartAsJPEG(new File(out), chart, width, height); break; } } catch (IOException e) { Plan.logger.error(e.getMessage(), e); return false; } return true; }
From source file:canreg.client.analysis.TopNChartTableBuilder.java
public TopNChartTableBuilder() { ChartTheme chartTheme = new StandardChartTheme("sansserif"); ChartFactory.setChartTheme(chartTheme); }
From source file:org.drugis.addis.gui.GUIFactory.java
public static void configureJFreeChartLookAndFeel() { StandardChartTheme chartTheme = new StandardChartTheme("ADDIS"); chartTheme.setBarPainter(new StandardBarPainter()); chartTheme.setShadowVisible(false);//from ww w .j a v a 2 s . co m ChartFactory.setChartTheme(chartTheme); }
From source file:org.uncommons.watchmaker.swing.evolutionmonitor.EvolutionMonitor.java
private void init(Renderer<? super T, JComponent> renderer) { // Make sure all JFreeChart charts are created with the legacy theme // (grey surround and white data area). ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JTabbedPane tabs = new JTabbedPane(); monitorComponent = new JPanel(new BorderLayout()); monitorComponent.add(tabs, BorderLayout.CENTER); FittestCandidateView<T> candidateView = new FittestCandidateView<T>(renderer); tabs.add("Fittest Individual", candidateView); views.add(new SwingIslandEvolutionObserver<T>(candidateView, 300, TimeUnit.MILLISECONDS)); PopulationFitnessView fitnessView = new PopulationFitnessView(islands); tabs.add(islands ? "Global Population" : "Population Fitness", fitnessView); views.add(fitnessView);/* w w w . j av a2s.c om*/ if (islands) { IslandsView islandsView = new IslandsView(); tabs.add("Island Populations", islandsView); views.add(new SwingIslandEvolutionObserver<Object>(islandsView, 300, TimeUnit.MILLISECONDS)); } JVMView jvmView = new JVMView(); tabs.add("JVM Memory", jvmView); StatusBar statusBar = new StatusBar(islands); monitorComponent.add(statusBar, BorderLayout.SOUTH); views.add(new SwingIslandEvolutionObserver<Object>(statusBar, 300, TimeUnit.MILLISECONDS)); }
From source file:com.glaf.chart.util.ChartUtils.java
public static void setChartTheme(Chart chartModel) { // ?//from w w w. j a va 2s . c o m StandardChartTheme standardChartTheme = new StandardChartTheme("cn"); // if (chartModel.getChartTitleFont() != null && chartModel.getChartTitleFontSize() != null && chartModel.getChartTitleFontSize() > 0) { standardChartTheme.setExtraLargeFont( new Font(chartModel.getChartTitleFont(), Font.BOLD, chartModel.getChartTitleFontSize())); } else { standardChartTheme.setExtraLargeFont(new Font("", Font.BOLD, 18)); } if (chartModel.getChartFont() != null && chartModel.getChartFontSize() > 0) { // standardChartTheme .setRegularFont(new Font(chartModel.getChartFont(), Font.PLAIN, chartModel.getChartFontSize())); // ? standardChartTheme .setLargeFont(new Font(chartModel.getChartFont(), Font.PLAIN, chartModel.getChartFontSize())); } else { // standardChartTheme.setRegularFont(new Font("", Font.PLAIN, 14)); // ? standardChartTheme.setLargeFont(new Font("", Font.PLAIN, 14)); } // ? ChartFactory.setChartTheme(standardChartTheme); }
From source file:speedbagalg.OscopeView.java
/** * Creates new form OscopeView// www. j a v a 2s . com */ /* public OscopeView(String fileName) { this.fileName = fileName; initComponents(); updateThread = new RunnableMember2(this, "updateGUI"); ChartFactory.setChartTheme(new StandardChartTheme("JFree/Shadow", true)); // create a dataset... int maxAge = 2400; this.xData = new TimeSeries("X axis"); this.xData.setMaximumItemAge(maxAge); this.yData = new TimeSeries("Y axis"); this.yData.setMaximumItemAge(maxAge); this.zData = new TimeSeries("Z axis"); this.zData.setMaximumItemAge(maxAge); this.averageData = new TimeSeries("Avg. Data"); this.averageData.setMaximumItemAge(maxAge); //this.windSpeedSeries = new TimeSeries("Wind Speed"); //this.windSpeedSeries.setMaximumItemAge(maxAge); //this.rainSeries = new TimeSeries("Rain 24hrs"); //this.rainSeries.setMaximumItemAge(maxAge); final TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(xData); dataset.addSeries(yData); dataset.addSeries(zData); dataset.addSeries(averageData); //dataset.addSeries(windSpeedSeries); //dataset.addSeries(rainSeries); final JFreeChart chart = ChartFactory.createTimeSeriesChart( "Accel Data", "Time", "Value", dataset, true, true, false); final XYPlot plot = chart.getXYPlot(); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis = plot.getRangeAxis(); axis.setRange(-1000.0, 10000.0); chart.setBackgroundPaint(Color.white); //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); // create and display a frame... thePanel = new ChartPanel(chart); Dimension d = new Dimension(200, 100); thePanel.setSize(d); thePanel.setPreferredSize(d); BorderLayout layout = new BorderLayout(); jPanelOscope.setLayout(layout); jPanelOscope.add(thePanel, BorderLayout.CENTER); plotXCheckBox.setSelected(plotX); plotYCheckBox.setSelected(plotY); plotZCheckBox.setSelected(plotZ); } */ public OscopeView(String fileName) { this.fileName = fileName; initComponents(); updateThread = new RunnableMember2(this, "updateGUI"); ChartFactory.setChartTheme(new StandardChartTheme("JFree/Shadow", true)); // create a dataset... this.xData = new XYSeries("Min"); //this.xData.setMaximumItemAge(maxAge); this.yData = new XYSeries("Peak"); //this.yData.setMaximumItemAge(maxAge); this.zData = new XYSeries("Z axis"); //this.zData.setMaximumItemAge(maxAge); this.averageData = new XYSeries("Avg. Data"); //this.averageData.setMaximumItemAge(maxAge); //this.windSpeedSeries = new TimeSeries("Wind Speed"); //this.windSpeedSeries.setMaximumItemAge(maxAge); //this.rainSeries = new TimeSeries("Rain 24hrs"); //this.rainSeries.setMaximumItemAge(maxAge); final XYSeriesCollection dataset = new XYSeriesCollection(); //SlidingCategoryDataset dataset = new SlidingCategoryDataset(0, 10); dataset.addSeries(xData); dataset.addSeries(yData); dataset.addSeries(zData); dataset.addSeries(averageData); //dataset.addSeries(windSpeedSeries); //dataset.addSeries(rainSeries); chart = ChartFactory.createXYLineChart("Accel Data", "Time", "Value", dataset, PlotOrientation.VERTICAL, true, true, false); final XYPlot plot = chart.getXYPlot(); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(false); axis.setRange(minStart, maxDomain); axis = plot.getRangeAxis(); axis.setRange(vMin, vMax); chart.setBackgroundPaint(Color.white); //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); // create and display a frame... thePanel = new ChartPanel(chart); Dimension d = new Dimension(200, 100); thePanel.setSize(d); thePanel.setPreferredSize(d); BorderLayout layout = new BorderLayout(); jPanelOscope.setLayout(layout); jPanelOscope.add(thePanel, BorderLayout.CENTER); plotXCheckBox.setSelected(plotX); plotYCheckBox.setSelected(plotY); plotZCheckBox.setSelected(plotZ); vMaxSpinner.setValue(vMax); }
From source file:org.sbml.bargraph.MainWindow.java
/** * Creates an empty bar graph./*from www. ja v a2s .co m*/ * @return */ public JFreeChart createModelBarGraph() { // Initialize the style. Have to do this before creating charts. BarRenderer.setDefaultShadowsVisible(false); ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); // Create the actual chart. chartData = new DefaultCategoryDataset(); JFreeChart chart = ChartFactory.createBarChart(null, // chart title null, // domain axis label "Total count", // range axis label chartData, // data PlotOrientation.HORIZONTAL, // orientation false, // include legend false, // tooltips? false // URLs? ); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.lightGray); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12)); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12)); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, new Color(0, 101, 178)); return chart; }
From source file:virgil.meanback.HistoryInfo.java
public void printChart(Stock stock, List<String[]> list, int days) throws Exception { //?/* ww w. ja va 2 s . co m*/ StandardChartTheme standardChartTheme = new StandardChartTheme("CN"); // standardChartTheme.setExtraLargeFont(new Font("", Font.BOLD, 20)); // standardChartTheme.setRegularFont(new Font("", Font.BOLD, 12)); //? standardChartTheme.setLargeFont(new Font("", Font.BOLD, 18)); //? ChartFactory.setChartTheme(standardChartTheme); DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); for (int i = list.size() - 1; i >= 0; i--) { String[] s = (String[]) list.get(i); dataSet.addValue(Double.parseDouble(s[1]), days + "", s[0]); dataSet.addValue(Double.parseDouble(stock.getList().get(i).getClose()), "", s[0]); float sub = Float.parseFloat(s[2]); float error = Float.parseFloat(s[3]); if (sub > error * 2) { dataSet.addValue(Double.parseDouble(stock.getList().get(i).getClose()), "??", s[0]); } } //?????Legend //???? //??URL JFreeChart chart = ChartFactory.createLineChart( stock.getName() + "(" + stock.getCode() + ") ", "", "", dataSet, PlotOrientation.VERTICAL, true, true, false); CategoryPlot cp = chart.getCategoryPlot(); cp.setBackgroundPaint(ChartColor.WHITE); // CategoryAxis categoryAxis = cp.getDomainAxis(); // Lable 90 Font labelFont = new Font("SansSerif", Font.TRUETYPE_FONT, 10); categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); categoryAxis.setTickLabelFont(labelFont);//X?? ValueAxis yAxis = cp.getRangeAxis(); yAxis.setAutoRange(true); double[] d = getAxiasThresold(stock, list); yAxis.setLowerBound(d[0] - 0.15); yAxis.setUpperBound(d[1] + 0.15); LineAndShapeRenderer lasp = (LineAndShapeRenderer) cp.getRenderer(); lasp.setBaseFillPaint(ChartColor.RED); lasp.setDrawOutlines(true); lasp.setSeriesShape(0, new java.awt.geom.Ellipse2D.Double(-5D, -5D, 10D, 10D)); LineAndShapeRenderer renderer = (LineAndShapeRenderer) cp.getRenderer(1);//? DecimalFormat decimalformat1 = new DecimalFormat("##.##");//??? renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", decimalformat1)); //???? renderer.setItemLabelsVisible(true);// renderer.setBaseItemLabelsVisible(true);// //????? renderer.setShapesFilled(Boolean.TRUE);//?? renderer.setShapesVisible(true);//? ChartFrame chartFrame = new ChartFrame("??", chart, true); //chart?JavaChartFramejavaJframe???? chartFrame.pack(); //?? chartFrame.setVisible(true);//??? }