private Highstock addMarginSeriesData(final Highstock hs) { final List<FarmStrategyProfit> profits = farmStrategy.getProfits(); // Fill Data final List<Data> medianProfit = new ArrayList<Data>(); final List<Data> minProfit = new ArrayList<Data>(); final List<Data> profitSampleSize = new ArrayList<Data>(); for (FarmStrategyProfit profit : profits) { medianProfit.add( new Data(profit.getProfitTimestamp(), profit.getMedianSalePrice().toLong() / 10000.0)); minProfit.add( new Data(profit.getProfitTimestamp(), profit.getMinSalePrice().toLong() / 10000.0)); profitSampleSize.add(new Data(profit.getProfitTimestamp(), profit.getSalePriceSampleSize())); } hs.series() .add( new Series(medianProfit) .color(MIN_SALE_PRICE_SERIES_COLOR) .name("Median Profit") .index(0) .type("area") .shadow(true)); hs.series() .add( new Series(minProfit) .color(MIN_MATERIAL_COST_SERIES_COLOR) .name("Minimaler Profit") .index(1) .type("area") .shadow(true)); hs.series() .add( new Series(profitSampleSize) .color(MATERIAL_SAMPLE_SIZE_SERIES_COLOR) .name("Samples") .index(4) .type("area") .showInLegend(false) .shadow(true) .yAxis(1)); return hs; }
private Highstock createCraftingStockchart() { Highstock hs = new Highstock(); hs.chart("farmingChart").backgroundColor(CHART_BACKGROUND_COLOR); /* hs.navigator().enabled(true).top(320); hs.scrollbar().enabled(true); */ hs.navigator().enabled(false); hs.scrollbar().enabled(false); hs.rangeSelector() .buttons(RANGESELECTOR_24H, RANGESELECTOR_1W, RANGESELECTOR_ALL) .selected(1) .inputEnabled(false); hs.credits().enabled(false); hs.exporting().enabled(true); hs.legend().enabled(false); hs.xAxis().add(new XAxis().min(60 * 60 * 1000).top(-70)); hs.yAxis() .add(new YAxis().title("Kosten").min(0).height(100).lineWidth(2).top(50)) .add(new YAxis().title("Samples").top(175).height(50).offset(0).lineWidth(2)); return hs; }
@Override public void renderHead(IHeaderResponse response) { Highstock.lang(Lang.GERMAN); Highstock.global().useUTC(false); addMarginSeriesData(createCraftingStockchart()).render(response); }