Create your first ZK Charts"
From Documentation
Raymondchao (talk | contribs) |
Raymondchao (talk | contribs) |
||
Line 5: | Line 5: | ||
In the section we will show how to create your first ZK Charts component step by step. | In the section we will show how to create your first ZK Charts component step by step. | ||
− | First, declare a chart component in | + | First, declare a chart component in a ZUML document. Assign <tt>type</tt> and <tt>title</tt> properties to it. |
− | < | + | <window apply="ChartComposer"> |
<charts id="chart" type="line" title="Season Average Temperature" /> | <charts id="chart" type="line" title="Season Average Temperature" /> | ||
− | </ | + | </window> |
Then give some additional settings in composer: | Then give some additional settings in composer: |
Revision as of 05:00, 5 March 2014
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 >