List of usage examples for java.awt Color LIGHT_GRAY
Color LIGHT_GRAY
To view the source code for java.awt Color LIGHT_GRAY.
Click Source Link
From source file:de.atomfrede.tools.evalutation.tools.plot.TimePlot.java
@Override protected JFreeChart createChart(XYDatasetWrapper... datasetWrappers) { XYDatasetWrapper mainDataset = datasetWrappers[0]; JFreeChart chart = ChartFactory.createTimeSeriesChart(mainDataset.getSeriesName(), "Time", mainDataset.getSeriesName(), mainDataset.getDataset(), true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); // all adjustments for first/main dataset plot.getRangeAxis(0).setLowerBound(mainDataset.getMinimum()); plot.getRangeAxis(0).setUpperBound(mainDataset.getMaximum()); // some additional "design" stuff for the plot plot.getRenderer(0).setSeriesPaint(0, mainDataset.getSeriesColor()); plot.getRenderer(0).setSeriesStroke(0, new BasicStroke(mainDataset.getStroke())); for (int i = 1; i < datasetWrappers.length; i++) { XYDatasetWrapper wrapper = datasetWrappers[i]; plot.setDataset(i, wrapper.getDataset()); chart.setTitle(chart.getTitle().getText() + "/" + wrapper.getSeriesName()); NumberAxis axis = new NumberAxis(wrapper.getSeriesName()); plot.setRangeAxis(i, axis);//from w w w . j ava 2 s .co m plot.setRangeAxisLocation(i, AxisLocation.BOTTOM_OR_RIGHT); plot.getRangeAxis(i).setLowerBound(wrapper.getMinimum() - 15.0); plot.getRangeAxis(i).setUpperBound(wrapper.getMaximum() + 15.0); // map the second dataset to the second axis plot.mapDatasetToRangeAxis(i, i); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setBaseShapesVisible(false); renderer.setSeriesStroke(0, new BasicStroke(wrapper.getStroke())); plot.setRenderer(i, renderer); plot.getRenderer(i).setSeriesPaint(0, wrapper.getSeriesColor()); } // change the background and gridline colors plot.setBackgroundPaint(Color.white); plot.setDomainMinorGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); // format the date axis DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("dd.MM HH:mm")); axis.setTickUnit(new DateTickUnit(DateTickUnitType.HOUR, 1)); axis.setVerticalTickLabels(true); return chart; }
From source file:net.sf.dynamicreports.test.jasper.chart.HighLowChartTest.java
@Override protected void configureReport(JasperReportBuilder rb) { TextColumnBuilder<String> column1; TextColumnBuilder<Date> column2; TextColumnBuilder<Double> column3; TextColumnBuilder<Double> column4; TextColumnBuilder<Double> column5; TextColumnBuilder<Double> column6; TextColumnBuilder<Double> column7; Locale.setDefault(Locale.ENGLISH); rb.columns(column1 = col.column("Column1", "field1", String.class), column2 = col.column("Column2", "field2", Date.class), column3 = col.column("Column3", "field3", Double.class), column4 = col.column("Column4", "field4", Double.class), column5 = col.column("Column5", "field5", Double.class), column6 = col.column("Column6", "field6", Double.class), column7 = col.column("Column7", "field7", Double.class)) .summary(/*from w w w .j a va 2 s . c om*/ cht.highLowChart().setSeries(column1).setDate(column2).setHigh(column3).setLow(column4) .setOpen(column5).setClose(column6).setVolume(column7).setShowOpenTicks(true) .setShowCloseTicks(true), cht.highLowChart().setSeries(column1).setDate(column2).setHigh(column3).setLow(column4) .setOpen(column5).setClose(column6).setVolume(column7) .setTimeAxisFormat(cht.axisFormat().setLabel("time").setLabelColor(Color.BLUE) .setLabelFont(stl.fontArialBold()) .setTickLabelFont(stl.fontArial().setItalic(true)) .setTickLabelColor(Color.CYAN).setLineColor(Color.LIGHT_GRAY) .setVerticalTickLabels(true)), cht.highLowChart().setSeries(column1).setDate(column2).setHigh(column3).setLow(column4) .setOpen(column5).setClose(column6).setVolume(column7) .setValueAxisFormat(cht.axisFormat().setLabel("value").setLabelColor(Color.BLUE) .setLabelFont(stl.fontArialBold()) .setTickLabelFont(stl.fontArial().setItalic(true)) .setTickLabelColor(Color.CYAN).setTickLabelMask("#,##0.00") .setLineColor(Color.LIGHT_GRAY).setRangeMinValueExpression(1) .setRangeMaxValueExpression(15).setVerticalTickLabels(true))); }
From source file:com.tcz.api.config.captcha.CaptchaEngine.java
/** * ?/*from www .j a v a 2s .c o m*/ */ public void afterPropertiesSet() throws Exception { Assert.state(imageWidth > 0); Assert.state(imageHeight > 0); Assert.state(minFontSize > 0); Assert.state(maxFontSize > 0); Assert.state(minWordLength > 0); Assert.state(maxWordLength > 0); Assert.hasText(charString); Font[] fonts = new Font[] { new Font("Arial", Font.BOLD, maxFontSize), new Font("Bell", Font.BOLD, maxFontSize), new Font("Credit", Font.BOLD, maxFontSize), new Font("Impact", Font.BOLD, maxFontSize) }; FontGenerator fontGenerator = new RandomFontGenerator(minFontSize, maxFontSize, fonts); BackgroundGenerator backgroundGenerator = StringUtils.isNotEmpty(backgroundImagePath) ? new FileReaderRandomBackgroundGenerator(imageWidth, imageHeight, servletContext.getRealPath(backgroundImagePath)) : new FunkyBackgroundGenerator(imageWidth, imageHeight); TextPaster textPaster = new RandomTextPaster(minWordLength, maxWordLength, Color.LIGHT_GRAY); CaptchaFactory[] captchaFactories = new CaptchaFactory[] { new GimpyFactory(new RandomWordGenerator(charString), new ComposedWordToImage(fontGenerator, backgroundGenerator, textPaster)) }; super.setFactories(captchaFactories); }
From source file:net.sf.dynamicreports.test.jasper.chart.ThermometerChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);/*from w ww. jav a 2 s . c o m*/ JFreeChart chart = getChart("summary.chart1", 0); Plot plot = chart.getPlot(); Assert.assertEquals("renderer", ThermometerPlot.class, plot.getClass()); ThermometerPlot thermometerPlot = (ThermometerPlot) plot; Assert.assertEquals("value", 15, thermometerPlot.getDataset().getValue()); Assert.assertEquals("data range low", 3d, thermometerPlot.getLowerBound()); Assert.assertEquals("data range high", 30d, thermometerPlot.getUpperBound()); Assert.assertEquals("value color", Color.BLUE, thermometerPlot.getValuePaint()); try { Field field = thermometerPlot.getClass().getDeclaredField("valueFormat"); field.setAccessible(true); Assert.assertEquals("value mask", "15.0", ((NumberFormat) field.get(thermometerPlot)).format(15)); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } Assert.assertEquals("value font", new Font("Arial", Font.PLAIN, 10), thermometerPlot.getValueFont()); Assert.assertEquals("value location", ThermometerPlot.BULB, thermometerPlot.getValueLocation()); Assert.assertEquals("mercury color", Color.LIGHT_GRAY, thermometerPlot.getMercuryPaint()); try { Field field = thermometerPlot.getClass().getDeclaredField("subrangeInfo"); field.setAccessible(true); double[][] subrangeInfo = (double[][]) field.get(thermometerPlot); Assert.assertEquals("low data range low", 8d, subrangeInfo[2][0]); Assert.assertEquals("low data range high", 10d, subrangeInfo[2][1]); Assert.assertEquals("medium data range low", 18d, subrangeInfo[1][0]); Assert.assertEquals("medium data range high", 20d, subrangeInfo[1][1]); Assert.assertEquals("high data range low", 28d, subrangeInfo[0][0]); Assert.assertEquals("high data range high", 30d, subrangeInfo[0][1]); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
From source file:com.bdb.weather.display.current.Barometer.java
private ChartViewer createChartElements(Pressure min, Pressure max) { Color backgroundDialColor = StageUtilities .toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_DIAL_COLOR)); Paint backgroundPaint = new GradientPaint(0.0f, 0.0f, Color.LIGHT_GRAY, 100.0f, 0.0f, backgroundDialColor); DialBackground background = new DialBackground(backgroundPaint); plot.addLayer(background);/*from w w w .j av a 2s.c om*/ double dialTickIncrements = .2; switch (Pressure.getDefaultUnit()) { case IN_HG: dialTickIncrements = .2; break; case HECTO_PASCAL: case MILLIBAR: dialTickIncrements = 10.0; break; } scale = new StandardDialScale(min.get(), max.get(), 240.0, -300.0, dialTickIncrements, 10); scale.setTickLabelFont(scale.getTickLabelFont().deriveFont(14.0F).deriveFont(Font.PLAIN)); scale.setTickRadius(.9); scale.setTickLabelFormatter(Pressure.getDefaultFormatter()); scale.setTickLabelOffset(.25); scale.setTickLabelPaint( StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_SCALE_TEXT))); scale.setMajorTickPaint( StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_SCALE_TICK))); scale.setMinorTickPaint( StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_SCALE_TICK))); plot.addScale(0, scale); plot.setDialFrame(new StandardDialFrame()); DialValueIndicator valueInd = new DialValueIndicator(0); // // Set background and outline paint to be completely transparent so they do not show at all // valueInd.setBackgroundPaint(new Color(255, 255, 255, 0)); valueInd.setOutlinePaint(new Color(255, 255, 255, 0)); valueInd.setPaint(StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_VALUE))); valueInd.setNumberFormat(Pressure.getDefaultUnit().getFormatterWithUnit()); plot.addLayer(valueInd); double angle = valueInd.getAngle(); double radius = valueInd.getRadius(); trendAnnotation.setPaint(StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_VALUE))); trendAnnotation.setAngle(angle); trendAnnotation.setRadius(radius + .1); plot.addLayer(trendAnnotation); DialPointer.Pointer pointer = new DialPointer.Pointer(0); plot.addPointer(pointer); DialCap cap = new DialCap(); cap.setRadius(cap.getRadius() * 1.5); plot.setCap(cap); range = new StandardDialRange(0.0, 360.0, StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_VALUE_RANGE))); range.setInnerRadius(.40); range.setOuterRadius(.45); range.setScaleIndex(0); plot.addLayer(range); JFreeChart chart = new JFreeChart(plot); chart.setBackgroundPaint( StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_BACKGROUND))); ChartViewer chartViewer = new ChartViewer(chart); chartViewer.setMinHeight(200); chartViewer.setMinWidth(200); chartViewer.setMaxHeight(10000); chartViewer.setMaxWidth(10000); //chartViewer.setBorder(new BevelBorder(BevelBorder.RAISED)); return chartViewer; }
From source file:com.rapidminer.gui.viewer.ROCChartPlotter.java
private JFreeChart createChart(XYDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title null, // x axis label null, // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls );/* www . jav a 2 s. c o m*/ 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.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); ValueAxis valueAxis = plot.getRangeAxis(); valueAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD); valueAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD); domainAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT); DeviationRenderer renderer = new DeviationRenderer(true, false); Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); if (dataset.getSeriesCount() == 1) { renderer.setSeriesStroke(0, stroke); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesFillPaint(0, Color.RED); } else if (dataset.getSeriesCount() == 2) { renderer.setSeriesStroke(0, stroke); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesFillPaint(0, Color.RED); renderer.setSeriesStroke(1, stroke); renderer.setSeriesPaint(1, Color.BLUE); renderer.setSeriesFillPaint(1, Color.BLUE); } else { for (int i = 0; i < dataset.getSeriesCount(); i++) { renderer.setSeriesStroke(i, stroke); Color color = colorProvider.getPointColor((double) i / (double) (dataset.getSeriesCount() - 1)); renderer.setSeriesPaint(i, color); renderer.setSeriesFillPaint(i, color); } } renderer.setAlpha(0.12f); plot.setRenderer(renderer); // legend settings LegendTitle legend = chart.getLegend(); if (legend != null) { legend.setPosition(RectangleEdge.TOP); legend.setFrame(BlockBorder.NONE); legend.setHorizontalAlignment(HorizontalAlignment.LEFT); legend.setItemFont(PlotterAdapter.LABEL_FONT); } return chart; }
From source file:fr.ign.cogit.simplu3d.rjmcmc.generic.visitor.StatsVisitor.java
/** * Creates a sample chart.// ww w.ja va 2 s . co m * * @param dataset * the dataset. * @return A sample chart. */ private JFreeChart createChart(final XYDataset dataset) { final JFreeChart result = ChartFactory.createXYLineChart("volution de l'nergie", "Itration", "nergie", dataset, PlotOrientation.VERTICAL, true, true, true); result.setBorderPaint(Color.white); result.setBackgroundPaint(Color.white); final XYPlot plot = result.getXYPlot(); Font font = new Font("Verdana", Font.PLAIN, 32); Font font2 = new Font("Verdana", Font.PLAIN, 28); // axe x ValueAxis axis = plot.getDomainAxis(); axis.setLabelFont(font); axis.setTickLabelFont(font2); axis.setAutoRange(true); // axis.setFixedAutoRange(60000.0); // 60 seconds axis = plot.getRangeAxis(); // axe y ValueAxis axis2 = plot.getRangeAxis(); axis2.setLabelFont(font); axis2.setTickLabelFont(font2); axis2.setAutoRange(true); // axis.setFixedAutoRange(60000.0); // 60 seconds axis2 = plot.getRangeAxis(); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setBackgroundPaint(Color.white); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, new Color(255, 0, 0)); renderer.setSeriesStroke(0, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f)); renderer.setLegendTextFont(0, font2); renderer.setSeriesPaint(1, new Color(2, 157, 116)); renderer.setSeriesStroke(1, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f)); renderer.setLegendTextFont(1, font2); renderer.setSeriesPaint(2, new Color(112, 147, 219)); renderer.setSeriesStroke(2, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f)); renderer.setLegendTextFont(2, font2); renderer.setSeriesPaint(3, new Color(140, 23, 23)); renderer.setSeriesStroke(3, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 6.0f, 6.0f }, 0.0f)); renderer.setLegendTextFont(3, font2); // axis.setRange(0.0, 200.0); return result; }
From source file:com.wattzap.view.graphs.GenericScatterGraph.java
public void addLine(XYSeries series) { // add a second dataset and renderer... final XYItemRenderer renderer = new StandardXYItemRenderer() { //Stroke regularStroke = new BasicStroke(0.7f); public Color color; //@Override //public Stroke getItemStroke(int row, int column) { //return regularStroke; //}/* ww w.j a va 2 s.c o m*/ @Override public Paint getItemPaint(int row, int column) { return color; } //public Shape lookupLegendShape(int series) { // return new Rectangle(15, 15); //} }; renderer.setBasePaint(Color.LIGHT_GRAY); plot.setRenderer(line, renderer); final IntervalXYDataset cadenceData = new XYSeriesCollection(series); plot.setDataset(line, cadenceData); line++; }
From source file:arduinouno.TimeChartGenerator.java
/** * Constructs a new dynamic chart application. * * @param title the frame title./*from w ww .jav a 2s . c o m*/ * @param theSerialLink * @param analogInputs */ public TimeChartGenerator(final String title, final SerialReader theSerialLink, Boolean[] analogInputs) { super(title); this.analogInputs = analogInputs; TimeSeriesCollection dataset = null, dataset0 = null, dataset1 = null, dataset2 = null, dataset3 = null, dataset4 = null, dataset5 = null; this.series = new TimeSeries("offset", Millisecond.class); //Serie de datos para el offset hacia la izquierda - (Magia) dataset = new TimeSeriesCollection(this.series); if (analogInputs[0]) { this.series0 = new TimeSeries("Read A0", Millisecond.class); //Serie de datos A0 dataset0 = new TimeSeriesCollection(this.series0); } if (analogInputs[1]) { this.series1 = new TimeSeries("Read A1", Millisecond.class); //Serie de datos A1 dataset1 = new TimeSeriesCollection(this.series1); } if (analogInputs[2]) { this.series2 = new TimeSeries("Read A2", Millisecond.class); //Serie de datos A2 dataset2 = new TimeSeriesCollection(this.series2); } if (analogInputs[3]) { this.series3 = new TimeSeries("Read A3", Millisecond.class); //Serie de datos A3 dataset3 = new TimeSeriesCollection(this.series3); } if (analogInputs[4]) { this.series4 = new TimeSeries("Read A4", Millisecond.class); //Serie de datos A4 dataset4 = new TimeSeriesCollection(this.series4); } if (analogInputs[5]) { this.series5 = new TimeSeries("Read A5", Millisecond.class); //Serie de datos A5 dataset5 = new TimeSeriesCollection(this.series5); } final JFreeChart chart = createChart(dataset, dataset0, dataset1, dataset2, dataset3, dataset4, dataset5); timer.setInitialDelay(1000); //Sets background color of chart chart.setBackgroundPaint(Color.LIGHT_GRAY); //Create Chartpanel for chart area chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(800, 500)); timer.start(); this.serialLink = theSerialLink; }
From source file:org.deeplearning4j.ui.TestRendering.java
@Ignore @Test/* ww w . ja va2s. c om*/ public void test() throws Exception { List<Component> list = new ArrayList<>(); //Common style for all of the charts StyleChart s = new StyleChart.Builder().width(640, LengthUnit.Px).height(480, LengthUnit.Px) .margin(LengthUnit.Px, 100, 40, 40, 20).strokeWidth(2).pointSize(4) .seriesColors(Color.GREEN, Color.MAGENTA).titleStyle(new StyleText.Builder().font("courier") .fontSize(16).underline(true).color(Color.GRAY).build()) .build(); //Line chart with vertical grid Component c1 = new ChartLine.Builder("Line Chart!", s) .addSeries("series0", new double[] { 0, 1, 2, 3 }, new double[] { 0, 2, 1, 4 }) .addSeries("series1", new double[] { 0, 1, 2, 3 }, new double[] { 0, 1, 0.5, 2.5 }) .setGridWidth(1.0, null) //Vertical grid lines, no horizontal grid .build(); list.add(c1); //Scatter chart Component c2 = new ChartScatter.Builder("Scatter!", s) .addSeries("series0", new double[] { 0, 1, 2, 3 }, new double[] { 0, 2, 1, 4 }).showLegend(true) .setGridWidth(0, 0).build(); list.add(c2); //Histogram with variable sized bins Component c3 = new ChartHistogram.Builder("Histogram!", s).addBin(-1, -0.5, 0.2).addBin(-0.5, 0, 0.5) .addBin(0, 1, 2.5).addBin(1, 2, 0.5).build(); list.add(c3); //Stacked area chart Component c4 = new ChartStackedArea.Builder("Area Chart!", s).setXValues(new double[] { 0, 1, 2, 3, 4, 5 }) .addSeries("series0", new double[] { 0, 1, 0, 2, 0, 1 }) .addSeries("series1", new double[] { 2, 1, 2, 0.5, 2, 1 }).build(); list.add(c4); //Table StyleTable ts = new StyleTable.Builder().backgroundColor(Color.LIGHT_GRAY).headerColor(Color.ORANGE) .borderWidth(1).columnWidths(LengthUnit.Percent, 20, 40, 40).width(500, LengthUnit.Px) .height(200, LengthUnit.Px).build(); Component c5 = new ComponentTable.Builder(ts).header("H1", "H2", "H3").content( new String[][] { { "row0col0", "row0col1", "row0col2" }, { "row1col0", "row1col1", "row1col2" } }) .build(); list.add(c5); //Accordion decorator, with the same chart StyleAccordion ac = new StyleAccordion.Builder().height(480, LengthUnit.Px).width(640, LengthUnit.Px) .build(); Component c6 = new DecoratorAccordion.Builder(ac).title("Accordion - Collapsed By Default!") .setDefaultCollapsed(true).addComponents(c5).build(); list.add(c6); //Text with styling Component c7 = new ComponentText.Builder("Here's some blue text in a green div!", new StyleText.Builder().font("courier").fontSize(30).underline(true).color(Color.BLUE).build()) .build(); //Div, with a chart inside Style divStyle = new StyleDiv.Builder().width(30, LengthUnit.Percent).height(200, LengthUnit.Px) .backgroundColor(Color.GREEN).floatValue(StyleDiv.FloatValue.right).build(); Component c8 = new ComponentDiv(divStyle, c7, new ComponentText("(Also: it's float right, 30% width, 200 px high )", null)); list.add(c8); //Timeline chart: List<ChartTimeline.TimelineEntry> entries = new ArrayList<>(); for (int i = 0; i < 10; i++) { entries.add(new ChartTimeline.TimelineEntry("e0-" + i, 10 * i, 10 * i + 5, Color.BLUE)); } List<ChartTimeline.TimelineEntry> entries2 = new ArrayList<>(); for (int i = 0; i < 10; i++) { entries2.add(new ChartTimeline.TimelineEntry("e1-" + i, (int) (5 * i + 0.2 * i * i), (int) (5 * i + 0.2 * i * i) + 3, Color.ORANGE)); } List<ChartTimeline.TimelineEntry> entries3 = new ArrayList<>(); for (int i = 0; i < 10; i++) { entries3.add(new ChartTimeline.TimelineEntry("e2-" + i, (int) (2 * i + 0.6 * i * i + 3), (int) (2 * i + 0.6 * i * i + 3) + 2 * i + 1)); } Color[] c = new Color[] { Color.CYAN, Color.YELLOW, Color.GREEN, Color.PINK }; List<ChartTimeline.TimelineEntry> entries4 = new ArrayList<>(); Random r = new Random(12345); for (int i = 0; i < 10; i++) { entries4.add(new ChartTimeline.TimelineEntry("e3-" + i, (int) (2 * i + 0.6 * i * i + 3), (int) (2 * i + 0.6 * i * i + 3) + i + 1, c[r.nextInt(c.length)])); } Component c9 = new ChartTimeline.Builder("Title", s).addLane("Lane 0", entries).addLane("Lane 1", entries2) .addLane("Lane 2", entries3).addLane("Lane 3", entries4).build(); list.add(c9); //Generate HTML StringBuilder sb = new StringBuilder(); sb.append("<!DOCTYPE html>\n" + "<html lang=\"en\">\n" + "<head>\n" + " <meta charset=\"UTF-8\">\n" + " <title>Title</title>\n" + "</head>\n" + "<body>\n" + "\n" + " <div id=\"maindiv\">\n" + "\n" + " </div>\n" + "\n" + "\n" + " <script src=\"//code.jquery.com/jquery-1.10.2.js\"></script>\n" + " <script src=\"https://code.jquery.com/ui/1.11.4/jquery-ui.min.js\"></script>\n" + " <link rel=\"stylesheet\" href=\"//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css\">\n" + " <script src=\"https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js\"></script>\n" + " <script src=\"src/main/resources/assets/dl4j-ui.js\"></script>\n" + "\n" + " <script>\n"); ObjectMapper om = new ObjectMapper(); for (int i = 0; i < list.size(); i++) { Component component = list.get(i); sb.append(" ").append("var str").append(i).append(" = '") .append(om.writeValueAsString(component).replaceAll("'", "\\\\'")).append("';\n"); sb.append(" ").append("var obj").append(i).append(" = Component.getComponent(str").append(i) .append(");\n"); sb.append(" ").append("obj").append(i).append(".render($('#maindiv'));\n"); sb.append("\n\n"); } sb.append(" </script>\n" + "\n" + "</body>\n" + "</html>"); FileUtils.writeStringToFile(new File("TestRendering.html"), sb.toString()); }