GWT Google Charts Tutorial
Selected Reading
- GWT Google Charts - Discussion
- GWT Google Charts - Resources
- GWT Google Charts - Quick Guide
- GWT Google Charts - TreeMap Chart
- GWT Google Charts - Table Chart
- GWT Google Charts - Stepped Area
- GWT Google Charts - Scatter Chart
- GWT Google Charts - Sankey Charts
- GWT Google Charts - Pie Charts
- GWT Google Charts - Organization
- GWT Google Charts - Maps
- GWT Google Charts - Line Charts
- GWT Google Charts - Histogram
- GWT Google Charts - Combination
- GWT Google Charts - Column Charts
- GWT Google Charts - Candlestick
- GWT Google Charts - Bubble Charts
- GWT Google Charts - Bar Charts
- GWT Google Charts - Area Charts
- Configuration Syntax
- Environment Setup
- GWT Google Charts - Overview
- GWT Google Charts - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
GWT Google Charts - Organization
GWT Google Charts - Organization Chart
Following is an example of a Organization Chart.
Organization chart helps in rendering a hierarchy of nodes, used to portray superior/subordinate relationships in an organization. For example, A family tree is a type of org chart. We have already seen the configurations used to draw a chart in
chapter. Now, let us see an example of a Organization Chart.Configurations
We ve used OrgChart class to show a Organization Chart.
// Organization chart OrgChart chart = new OrgChart();
Example
HelloWorld.java
package com.tutorialspoint.cpent; import com.google.gwt.core.cpent.EntryPoint; import com.google.gwt.user.cpent.ui.RootPanel; import com.googlecode.gwt.charts.cpent.ChartLoader; import com.googlecode.gwt.charts.cpent.ChartPackage; import com.googlecode.gwt.charts.cpent.ColumnType; import com.googlecode.gwt.charts.cpent.DataTable; import com.googlecode.gwt.charts.cpent.format.PatternFormat; import com.googlecode.gwt.charts.cpent.orgchart.OrgChart; import com.googlecode.gwt.charts.cpent.orgchart.OrgChartOptions; pubpc class HelloWorld implements EntryPoint { private OrgChart chart; private void initiapze() { ChartLoader chartLoader = new ChartLoader(ChartPackage.ORGCHART); chartLoader.loadApi(new Runnable() { pubpc void run() { // Create and attach the chart chart = new OrgChart(); RootPanel.get().add(chart); draw(); } }); } private void draw() { // Prepare the data DataTable dataTable = DataTable.create(); dataTable.addColumn(ColumnType.STRING, "Name"); dataTable.addColumn(ColumnType.STRING, "Manager"); dataTable.addColumn(ColumnType.STRING, "ToolTip"); dataTable.addRows(5); dataTable.setValue(0, 0, "Mike"); dataTable.setValue(0, 1, ""); dataTable.setValue(0, 2, "The President"); dataTable.setValue(1, 0, "Jim"); dataTable.setValue(1, 1, "Mike"); dataTable.setValue(1, 2, "VP"); dataTable.setValue(2, 0, "Apce"); dataTable.setValue(2, 1, "Mike"); dataTable.setValue(2, 2, ""); dataTable.setValue(3, 0, "Bob"); dataTable.setValue(3, 1, "Jim"); dataTable.setValue(3, 2, "Bob Sponge"); dataTable.setValue(4, 0, "Carol"); dataTable.setValue(4, 1, "Bob"); dataTable.setValue(4, 2, ""); PatternFormat format = PatternFormat.create("{0} {1}"); format.format(dataTable, 0, 2); // Set options OrgChartOptions options = OrgChartOptions.create(); options.setAllowHtml(true); // Draw the chart chart.draw(dataTable, options); chart.setWidth("400px"); chart.setHeight("400px"); } pubpc void onModuleLoad() { initiapze(); } }
Result
Verify the result.
Advertisements