Search in sources :

Example 6 with MapDataItem

use of io.jmix.ui.data.impl.MapDataItem in project jmix-docs by Haulmont.

the class MapDataItemScreen method onInit.

@Subscribe
protected void onInit(InitEvent event) {
    ListDataProvider dataProvider = new ListDataProvider();
    dataProvider.addItem(new MapDataItem(ImmutableMap.of("value", 75, "description", "Sky")));
    dataProvider.addItem(new MapDataItem(ImmutableMap.of("value", 7, "description", "Shady side of pyramid")));
    dataProvider.addItem(new MapDataItem(ImmutableMap.of("value", 18, "description", "Sunny side of pyramid")));
    chart.setDataProvider(dataProvider);
// end::map-data-item[]
}
Also used : ListDataProvider(io.jmix.ui.data.impl.ListDataProvider) MapDataItem(io.jmix.ui.data.impl.MapDataItem) Subscribe(io.jmix.ui.screen.Subscribe)

Example 7 with MapDataItem

use of io.jmix.ui.data.impl.MapDataItem in project jmix-docs by Haulmont.

the class PolarChart method onInit.

@Subscribe
protected void onInit(InitEvent event) {
    ListDataProvider dataProvider = new ListDataProvider();
    dataProvider.addItem(new MapDataItem().add("direction", "N").add("value", 8.0));
    dataProvider.addItem(new MapDataItem().add("direction", "NE").add("value", 9.0));
    dataProvider.addItem(new MapDataItem().add("direction", "E").add("value", 4.5));
    dataProvider.addItem(new MapDataItem().add("direction", "SE").add("value", 3.5));
    dataProvider.addItem(new MapDataItem().add("direction", "S").add("value", 9.2));
    dataProvider.addItem(new MapDataItem().add("direction", "SW").add("value", 8.4));
    dataProvider.addItem(new MapDataItem().add("direction", "W").add("value", 11.1));
    dataProvider.addItem(new MapDataItem().add("direction", "NW").add("value", 10.0));
    polarChart.setDataProvider(dataProvider);
}
Also used : ListDataProvider(io.jmix.ui.data.impl.ListDataProvider) MapDataItem(io.jmix.ui.data.impl.MapDataItem)

Example 8 with MapDataItem

use of io.jmix.ui.data.impl.MapDataItem in project jmix-docs by Haulmont.

the class SerialChartJsonTitleTwo method graphData.

private DataItem graphData(int value) {
    MapDataItem item = new MapDataItem();
    item.add("value", value);
    return item;
}
Also used : MapDataItem(io.jmix.ui.data.impl.MapDataItem)

Example 9 with MapDataItem

use of io.jmix.ui.data.impl.MapDataItem in project jmix-docs by Haulmont.

the class StackedareaChart method transportCount.

private DataItem transportCount(int year, int cars, int motorcycles, int bicycles) {
    MapDataItem item = new MapDataItem();
    item.add("year", year);
    item.add("cars", cars);
    item.add("motorcycles", motorcycles);
    item.add("bicycles", bicycles);
    return item;
}
Also used : MapDataItem(io.jmix.ui.data.impl.MapDataItem)

Example 10 with MapDataItem

use of io.jmix.ui.data.impl.MapDataItem in project jmix by jmix-framework.

the class GanttChartLoader method loadChartData.

@Override
protected void loadChartData(ChartModel chart, Element element) {
    Element dataSet = element.element("data");
    if (dataSet != null) {
        ListDataProvider listDataProvider = new ListDataProvider();
        for (Object item : dataSet.elements("item")) {
            Element itemElement = (Element) item;
            MapDataItem dataItem = new MapDataItem();
            for (Element property : itemElement.elements("property")) {
                if (property.elements().size() > 0) {
                    List<MapDataItem> innerItems = new ArrayList<>();
                    for (Object innerItem : property.elements("item")) {
                        Element innerItemElement = (Element) innerItem;
                        MapDataItem innerDataItem = new MapDataItem();
                        for (Element innerProperty : innerItemElement.elements("property")) {
                            innerDataItem = loadDataItem(innerProperty, innerDataItem);
                        }
                        innerItems.add(innerDataItem);
                    }
                    dataItem.add(property.attributeValue("name"), innerItems);
                } else {
                    dataItem = loadDataItem(property, dataItem);
                }
            }
            listDataProvider.addItem(dataItem);
            chart.setDataProvider(listDataProvider);
        }
    }
}
Also used : ListDataProvider(io.jmix.ui.data.impl.ListDataProvider) Element(org.dom4j.Element) ArrayList(java.util.ArrayList) MapDataItem(io.jmix.ui.data.impl.MapDataItem)

Aggregations

MapDataItem (io.jmix.ui.data.impl.MapDataItem)14 ListDataProvider (io.jmix.ui.data.impl.ListDataProvider)9 ChartSerializer (io.jmix.charts.widget.amcharts.serialization.ChartSerializer)3 Element (org.dom4j.Element)3 Test (org.junit.jupiter.api.Test)3 Scrollbar (io.jmix.charts.model.Scrollbar)2 ValueAxis (io.jmix.charts.model.axis.ValueAxis)2 Cursor (io.jmix.charts.model.cursor.Cursor)2 Export (io.jmix.charts.model.export.Export)2 Graph (io.jmix.charts.model.graph.Graph)2 DataProvider (io.jmix.ui.data.DataProvider)2 CategoryAxis (io.jmix.charts.model.axis.CategoryAxis)1 Legend (io.jmix.charts.model.legend.Legend)1 TrendLine (io.jmix.charts.model.trendline.TrendLine)1 FormatStrings (io.jmix.core.metamodel.datatype.FormatStrings)1 Subscribe (io.jmix.ui.screen.Subscribe)1 LocalDateTime (java.time.LocalDateTime)1 ArrayList (java.util.ArrayList)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1