在选择选项中显示图像

时间:2019-04-06 20:14:17

标签: html angularjs

我的项目中的图像很小,想在选择选项中显示它。

public JFreeChart HourChart(CampaignWatcher choosenWatcher) throws UnknownHostException {
    ArrayList<ArrayList<HourObject>> data = GetWatcherData(choosenWatcher);
    TimeSeries timeSeries = new TimeSeries("Number of visitors");
    TimeSeries timeSeriesRef = new TimeSeries("Referential number of visitors");


    for(int i = 0; i<data.get(0).size();i++) {

        timeSeries.add(new Hour(data.get(0).get(i).hour,data.get(0).get(i).day,data.get(0).get(i).month,data.get(0).get(i).year),data.get(0).get(i).logObjects.size());
    }

    if(choosenWatcher.compareWithRef){
        for(int i = 0; i<data.get(1).size();i++) {
            timeSeriesRef.add(new Hour(data.get(1).get(i).hour,data.get(1).get(i).day,data.get(1).get(i).month,data.get(1).get(i).year),data.get(1).get(i).logObjects.size());
        }
    }

    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(timeSeries);

    JFreeChart timeChart = ChartFactory.createTimeSeriesChart(choosenWatcher.name,"Hours","Number of visitors",dataset);

    timeChart.setBackgroundPaint(Color.white);

    XYPlot plot = (XYPlot) timeChart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    //plot.setDomainCrosshairVisible(true);
    //plot.setRangeCrosshairVisible(true);

    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setDefaultLinesVisible(true);
        renderer.setDefaultShapesFilled(true);
        renderer.setDrawSeriesLineAsPath(true);
    }

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("dd/MMM/yyyy HH"));

    DateAxis axisRef = new DateAxis("Referential hours");
    axisRef.setDateFormatOverride(new SimpleDateFormat("dd/MMM/yyyy HH"));


    plot.setDomainAxis(1, axisRef);

    plot.setDomainAxisLocation(1,AxisLocation.BOTTOM_OR_RIGHT);

    TimeSeriesCollection datasetRef = new TimeSeriesCollection();
    datasetRef.addSeries(timeSeriesRef);
    plot.setDataset(1,datasetRef);

    plot.mapDatasetToDomainAxis(1,1);
    plot.mapDatasetToRangeAxis(1,0);

    XYLineAndShapeRenderer renderer0 = new XYLineAndShapeRenderer();
    XYLineAndShapeRenderer renderer1 = new XYLineAndShapeRenderer();

    plot.setRenderer(0, renderer0);
    plot.setRenderer(1, renderer1);

    plot.getRendererForDataset(plot.getDataset(0)).setSeriesPaint(0, Color.red);
    plot.getRendererForDataset(plot.getDataset(1)).setSeriesPaint(0, Color.blue);

    plot.setDomainPannable(true);
    plot.setRangePannable(true);

    ValueAxis valAxis = plot.getRangeAxis();

    valAxis.setAutoRange(true);

    return timeChart;
}

1 个答案:

答案 0 :(得分:2)

<option>元素唯一允许的内容是文本。

Content categories: None.
Permitted content:  Text, possibly with escaped characters (like &eacute;).
Tag omission:       The start tag is mandatory. The end tag is optional if this element is immediately followed by another <option> element or an <optgroup>, or if the parent element has no more content.
Permitted parents:  A <select>, an <optgroup> or a <datalist> element.
Permitted ARIA roles:   None
DOM interface:      HTMLOptionElement 

有关更多信息,请参见