Search in sources :

Example 1 with CategoryAxesSettings

use of io.jmix.charts.model.axis.CategoryAxesSettings in project jmix by jmix-framework.

the class StockChartSerializationTest method testStockChartWithIntradayDatas.

@Test
public void testStockChartWithIntradayDatas() throws ParseException, IOException, URISyntaxException {
    ListDataProvider chartData = new ListDataProvider();
    populateStockDatasourceWithTime(chartData, 40L, 100L);
    StockChartGroup stockChart = new StockChartGroup().setCategoryAxesSettings(new CategoryAxesSettings().setMinPeriod("mm")).addDataSets(new DataSet().setId("dataSet").setDataProvider(chartData).setColor(Color.valueOf("#b0de09")).setCategoryField("date").addFieldMappings(new FieldMapping().setFromField("value").setToField("value"), new FieldMapping().setFromField("volume").setToField("volume"))).addPanels(new StockPanel().setId("p1").setTitle("Value").setPercentHeight(70).setShowCategoryAxis(false).addStockGraphs(new StockGraph().setId("sg4").setValueField("value").setLineThickness(2).setType(GraphType.SMOOTHED_LINE).setBullet(BulletType.ROUND)).setStockLegend(new StockLegend().setValueTextRegular(" ").setMarkerType(MarkerType.NONE)), new StockPanel().setId("p2").setTitle("Volume").setPercentHeight(30).addStockGraphs(new StockGraph().setValueField("volume").setCornerRadiusTop(2).setType(GraphType.COLUMN).setFillAlphas(1.0)).setStockLegend(new StockLegend().setValueTextRegular(" ").setMarkerType(MarkerType.NONE))).setChartScrollbarSettings(new ChartScrollbarSettings().setGraph("sg4").setUsePeriod("10mm").setPosition(ChartScrollbarPosition.TOP)).setChartCursorSettings(new ChartCursorSettings().setValueLineBalloonEnabled(true)).setPeriodSelector(new PeriodSelector().setPosition(Position.TOP).setInputFieldWidth(150).addPeriods(new Period().setPeriod(PeriodType.HOURS).setCount(1).setLabel("1 hour").setSelected(true), new Period().setPeriod(PeriodType.HOURS).setCount(2).setLabel("2 hours"), new Period().setPeriod(PeriodType.HOURS).setCount(5).setLabel("5 hours"), new Period().setPeriod(PeriodType.HOURS).setCount(12).setLabel("12 hours"), new Period().setPeriod(PeriodType.MAX).setLabel("MAX"))).setPanelsSettings(new PanelsSettings().setUsePrefixes(true)).setExport(new Export().setPosition(ExportPosition.BOTTOM_RIGHT));
    StockChartSerializer serializer = getTestSerializer();
    String json = serializer.serialize(stockChart);
    String expected = readFile("StockChartWithIntradayDatas.json");
    assertEquals(prettyJson(expected), prettyJson(json));
}
Also used : ListDataProvider(io.jmix.ui.data.impl.ListDataProvider) DataSet(io.jmix.charts.model.dataset.DataSet) StockPanel(io.jmix.charts.model.chart.impl.StockPanel) FieldMapping(io.jmix.charts.model.dataset.FieldMapping) PanelsSettings(io.jmix.charts.model.settings.PanelsSettings) StockGraph(io.jmix.charts.model.stock.StockGraph) Period(io.jmix.charts.model.period.Period) ChartScrollbarSettings(io.jmix.charts.model.settings.ChartScrollbarSettings) StockChartSerializer(io.jmix.charts.widget.amcharts.serialization.StockChartSerializer) JmixStockChartSerializer(io.jmix.charts.serialization.JmixStockChartSerializer) CategoryAxesSettings(io.jmix.charts.model.axis.CategoryAxesSettings) Export(io.jmix.charts.model.export.Export) ChartCursorSettings(io.jmix.charts.model.settings.ChartCursorSettings) StockLegend(io.jmix.charts.model.stock.StockLegend) StockChartGroup(io.jmix.charts.model.chart.impl.StockChartGroup) PeriodSelector(io.jmix.charts.model.period.PeriodSelector) Test(org.junit.jupiter.api.Test)

Aggregations

CategoryAxesSettings (io.jmix.charts.model.axis.CategoryAxesSettings)1 StockChartGroup (io.jmix.charts.model.chart.impl.StockChartGroup)1 StockPanel (io.jmix.charts.model.chart.impl.StockPanel)1 DataSet (io.jmix.charts.model.dataset.DataSet)1 FieldMapping (io.jmix.charts.model.dataset.FieldMapping)1 Export (io.jmix.charts.model.export.Export)1 Period (io.jmix.charts.model.period.Period)1 PeriodSelector (io.jmix.charts.model.period.PeriodSelector)1 ChartCursorSettings (io.jmix.charts.model.settings.ChartCursorSettings)1 ChartScrollbarSettings (io.jmix.charts.model.settings.ChartScrollbarSettings)1 PanelsSettings (io.jmix.charts.model.settings.PanelsSettings)1 StockGraph (io.jmix.charts.model.stock.StockGraph)1 StockLegend (io.jmix.charts.model.stock.StockLegend)1 JmixStockChartSerializer (io.jmix.charts.serialization.JmixStockChartSerializer)1 StockChartSerializer (io.jmix.charts.widget.amcharts.serialization.StockChartSerializer)1 ListDataProvider (io.jmix.ui.data.impl.ListDataProvider)1 Test (org.junit.jupiter.api.Test)1