How use dCharts Widget in a Vaadin project?

∥☆過路亽.° 提交于 2020-02-23 07:12:48

问题


I was looking for a 'free alternative to Vaadin Charts and found DCharts Widget, but I can not find guides or complete documentation to' use. Does anyone know how to import and use this widget? The guides to get started?

  • Vaadin: 7.4
  • Apache Tomcat V8
  • JDK 1.8

回答1:


To use dCharts i have execute this step:

  1. Download .jar or copy dependency for maven/ivy from: https://vaadin.com/directory#!addon/dcharts-widget
  2. Follow the instructions in this official page based on your installation method. (I have choose to download .jar and compile it with Vaadin Plug-in for Eclipse)

Small exemple of code:

final VerticalLayout layout = new VerticalLayout();
    DataSeries dataSeries = new DataSeries()
      .add(1, 5, 8, 2, 3);

     SeriesDefaults seriesDefaults = new SeriesDefaults()
      .setRenderer(SeriesRenderers.BAR);

     Axes axes = new Axes()
     .addAxis(
             new XYaxis().setRenderer(AxisRenderers.CATEGORY)
             .setTicks(new Ticks()
                     .add("a", "b", "c", "d", "e")));

     Highlighter highlighter = new Highlighter()
     .setShow(false);

     Options options = new Options()
      .setSeriesDefaults(seriesDefaults)
      .setAxes(axes)
      .setHighlighter(highlighter);

     DCharts chart = new DCharts()
      .setDataSeries(dataSeries)
      .setOptions(options)
      .show();
layout.addComponent(chart);


来源:https://stackoverflow.com/questions/40265243/how-use-dcharts-widget-in-a-vaadin-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!