Search in sources :

Example 1 with NodeSeries

use of com.vaadin.flow.component.charts.model.NodeSeries in project flow-components by vaadin.

the class Organization method initDemo.

@Override
public void initDemo() {
    Chart chart = new Chart(ChartType.ORGANIZATION);
    Configuration conf = chart.getConfiguration();
    conf.getChart().setInverted(true);
    conf.getChart().setHeight("500px");
    conf.getTooltip().setOutside(true);
    conf.setTitle("Acme organization chart");
    NodeSeries series = createSeries();
    conf.addSeries(series);
    add(chart);
}
Also used : Configuration(com.vaadin.flow.component.charts.model.Configuration) NodeSeries(com.vaadin.flow.component.charts.model.NodeSeries) Chart(com.vaadin.flow.component.charts.Chart)

Example 2 with NodeSeries

use of com.vaadin.flow.component.charts.model.NodeSeries in project flow-components by vaadin.

the class Organization method createSeries.

private NodeSeries createSeries() {
    NodeSeries series = new NodeSeries();
    series.setName("Acme");
    Node acme = new Node("Acme");
    Node headOffice = new Node("Head Office");
    Node labs = new Node("Labs");
    Node coyoteBuilding = new Node("Coyote Building");
    Node roadRunnerBuilding = new Node("Road Runner Building");
    Node sales = new Node("Sales");
    Node marketing = new Node("Marketing");
    Node accounting = new Node("Accounting");
    Node administration = new Node("Administration");
    Node mdsOffice = new Node("MD's Office");
    Node josephMiler = new Node("Joseph Miler");
    josephMiler.setTitle("Head of Sales");
    josephMiler.setLayout(NodeLayout.HANGING);
    Node erikPerez = new Node("Erik Perez");
    erikPerez.setTitle("Head of Marketing");
    erikPerez.setLayout(NodeLayout.HANGING);
    Node emilyFox = new Node("Emily Fox");
    emilyFox.setTitle("Head of Accounting");
    Node ewanHerbert = new Node("Ewan Herbert");
    ewanHerbert.setTitle("Head of Admin");
    ewanHerbert.setLayout(NodeLayout.HANGING);
    Node kateKirby = new Node("Kate Kirby");
    Node vaughnWhiting = new Node("Vaughn Whiting");
    Node lisaWarner = new Node("Lisa Warner");
    Node mollyDodd = new Node("Molly Dodd");
    Node natashaKelly = new Node("Natasha Kelly");
    Node managingDirector = new Node("Sally Brown", "Sally Brown", "Managing Director");
    managingDirector.setColor(new SolidColor("#E4B651"));
    series.add(acme, headOffice);
    series.add(acme, labs);
    series.add(headOffice, coyoteBuilding);
    series.add(headOffice, roadRunnerBuilding);
    series.add(coyoteBuilding, sales);
    series.add(coyoteBuilding, marketing);
    series.add(coyoteBuilding, accounting);
    series.add(roadRunnerBuilding, administration);
    series.add(roadRunnerBuilding, mdsOffice);
    series.add(sales, josephMiler);
    series.add(marketing, erikPerez);
    series.add(accounting, emilyFox);
    series.add(administration, ewanHerbert);
    series.add(josephMiler, kateKirby);
    series.add(josephMiler, vaughnWhiting);
    series.add(erikPerez, lisaWarner);
    series.add(ewanHerbert, mollyDodd);
    series.add(ewanHerbert, natashaKelly);
    series.add(mdsOffice, managingDirector);
    PlotOptionsOrganization plotOptions = createPlotOptions();
    series.setPlotOptions(plotOptions);
    return series;
}
Also used : PlotOptionsOrganization(com.vaadin.flow.component.charts.model.PlotOptionsOrganization) NodeSeries(com.vaadin.flow.component.charts.model.NodeSeries) Node(com.vaadin.flow.component.charts.model.Node) SolidColor(com.vaadin.flow.component.charts.model.style.SolidColor)

Example 3 with NodeSeries

use of com.vaadin.flow.component.charts.model.NodeSeries in project flow-components by vaadin.

the class HasItemTest method getItemWithNodeSeriesThrowsUnsupportedOperationException.

@Test(expected = UnsupportedOperationException.class)
public void getItemWithNodeSeriesThrowsUnsupportedOperationException() {
    Chart chart = new Chart();
    Node node1 = new Node("Node1");
    Node node2 = new Node("Node2");
    NodeSeries series = new NodeSeries();
    series.add(node1, node2);
    chart.getConfiguration().addSeries(series);
    HasItem hasItem = new HasItemTestImpl(chart, 0, 0);
    hasItem.getItem();
}
Also used : HasItem(com.vaadin.flow.component.charts.events.HasItem) Node(com.vaadin.flow.component.charts.model.Node) NodeSeries(com.vaadin.flow.component.charts.model.NodeSeries) Test(org.junit.Test)

Aggregations

NodeSeries (com.vaadin.flow.component.charts.model.NodeSeries)3 Node (com.vaadin.flow.component.charts.model.Node)2 Chart (com.vaadin.flow.component.charts.Chart)1 HasItem (com.vaadin.flow.component.charts.events.HasItem)1 Configuration (com.vaadin.flow.component.charts.model.Configuration)1 PlotOptionsOrganization (com.vaadin.flow.component.charts.model.PlotOptionsOrganization)1 SolidColor (com.vaadin.flow.component.charts.model.style.SolidColor)1 Test (org.junit.Test)1