如何在Vaadin项目中使用dCharts Widget? [英] How use dCharts Widget in a Vaadin project?

查看:891
本文介绍了如何在Vaadin项目中使用dCharts Widget?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一个免费的替代Vaadin图表,并找到DCharts Widget,但我找不到指南或完整的文档,以使用。
有谁知道如何导入和使用这个小部件?

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. 下载.jar或复制maven / ivy的依赖项: https://vaadin.com/directory#!addon/dcharts-widget

  2. 按照说明操作根据您的安装方法此官方页面。 (我选择下载.jar并使用 Vaadin Eclipse插件进行编译)

  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)

代码的小例子:

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);

这篇关于如何在Vaadin项目中使用dCharts Widget?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆