- GWT Google Charts 教程
- GWT Google Charts - 首页
- GWT Google Charts - 概述
- 环境设置
- 配置语法
- GWT Google Charts - 面积图
- GWT Google Charts - 条形图
- GWT Google Charts - 气泡图
- GWT Google Charts - 蜡烛图
- GWT Google Charts - 柱状图
- GWT Google Charts - 组合图
- GWT Google Charts - 直方图
- GWT Google Charts - 折线图
- GWT Google Charts - 地图
- GWT Google Charts - 组织结构图
- GWT Google Charts - 饼图
- GWT Google Charts - Sankey 图
- GWT Google Charts - 散点图
- GWT Google Charts - 阶梯面积图
- GWT Google Charts - 表格图
- GWT Google Charts - 树状图
- GWT Google Charts 资源
- GWT Google Charts - 快速指南
- GWT Google Charts - 资源
- GWT Google Charts - 讨论
多级 Sankey 图
以下是一个包含多个级别的 SanKey 图示例。
我们已经在 Google Charts 配置语法 章节中看到了用于绘制图表的配置。现在,我们来看看一个包含多个级别的 SanKey 图的示例。
配置
我们已使用 Sankey 类显示包含多个级别的 Sankey 图。
Sankey chart = new Sankey();
示例
HelloWorld.java
package com.tutorialspoint.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.ui.RootPanel; import com.googlecode.gwt.charts.client.ChartLoader; import com.googlecode.gwt.charts.client.ChartPackage; import com.googlecode.gwt.charts.client.ColumnType; import com.googlecode.gwt.charts.client.DataTable; import com.googlecode.gwt.charts.client.sankey.Sankey; public class HelloWorld implements EntryPoint { private Sankey chart; private void initialize() { ChartLoader chartLoader = new ChartLoader(ChartPackage.SANKEY); chartLoader.loadApi(new Runnable() { public void run() { // Create and attach the chart chart = new Sankey(); RootPanel.get().add(chart); draw(); } }); } private void draw() { // Prepare the data DataTable data = DataTable.create(); data.addColumn(ColumnType.STRING, "From"); data.addColumn(ColumnType.STRING, "To"); data.addColumn(ColumnType.NUMBER, "Weight"); data.addRow("Brazil","Portugal",5); data.addRow("Brazil","France",1 ); data.addRow("Brazil","Spain",1 ); data.addRow("Brazil","England",1 ); data.addRow("Canada","Portugal",1 ); data.addRow("Canada","France",5 ); data.addRow("Canada","England",1 ); data.addRow("Mexico","Portugal",1 ); data.addRow("Mexico","France",1 ); data.addRow("Mexico","Spain",5 ); data.addRow("Mexico","England",1 ); data.addRow("USA","Portugal",1 ); data.addRow("USA","France",1 ); data.addRow("USA","Spain",1 ); data.addRow("USA","England",5); data.addRow("Portugal","Angola", 2 ); data.addRow("Portugal","Senegal", 1 ); data.addRow("Portugal", "Morocco", 1 ); data.addRow("Portugal","South Africa", 3 ); // Draw the chart chart.draw(data); chart.setWidth("400px"); chart.setHeight("400px"); } public void onModuleLoad() { initialize(); } }
结果
验证结果。
gwt_googlecharts_sankey_charts.htm
广告