Create your first ZK Charts"

From Documentation
Line 6: Line 6:
  
 
First, declare a chart component in a ZUML document. Assign <tt>type</tt> and <tt>title</tt> properties to it.
 
First, declare a chart component in a ZUML document. Assign <tt>type</tt> and <tt>title</tt> properties to it.
 
+
<source lang="xml">
 
<window apply="ChartComposer">
 
<window apply="ChartComposer">
 
     <charts id="chart" type="line" title="Season Average Temperature" />
 
     <charts id="chart" type="line" title="Season Average Temperature" />
 
</window>
 
</window>
 +
</source>
 
 
 
Then give some additional settings in composer:
 
Then give some additional settings in composer:

Revision as of 05:00, 5 March 2014

Create your first ZK Charts


WarningTriangle-32x32.png This page is under construction, so we cannot guarantee the accuracy of the content!

In the section we will show how to create your first ZK Charts component step by step.

First, declare a chart component in a ZUML document. Assign type and title properties to it.

<window apply="ChartComposer">
    <charts id="chart" type="line" title="Season Average Temperature" />
</window>

Then give some additional settings in composer:

    // Add "°C" to value in tooltip
    chart.getTooltip().setValueSuffix("°C");

    Legend legend = chart.getLegend();
    // Set lengend's layout and alignment
    legend.setLayout("vertical");
    legend.setAlign("right");
    legend.setVerticalAlign("middle");
    // Set lenged's border width to 0
    legend.setBorderWidth(0);

There has many ways to And we can specify chart data with model:

    CategoryModel model = new SimpleCategoryModel();

    model.setValue("Tokyo", "Spring", new Integer(11));
    model.setValue("Tokyo", "Summer", new Integer(20));
    model.setValue("Tokyo", "Fall", new Integer(16));
    model.setValue("Tokyo", "Winter", new Integer(9));
    model.setValue("New York", "Spring", new Integer(6));
    model.setValue("New York", "Summer", new Integer(14));
    model.setValue("New York", "Fall", new Integer(8));
    model.setValue("New York", "Winter", new Integer(2));

    chart.setModel(model);

< Get Complete Source Code of This Book >


Last Update : 2014/03/05

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.