<%@page contentType="text/plain" pageEncoding="UTF-8"
import="jofc2.*,
jofc2.model.*,
jofc2.model.elements.*,
jofc2.model.axis.*,
jofc2.model.elements.BarChart.*,
jofc2.model.elements.LineChart.*"%>
<%
Chart cht = new Chart("存貨量線型圖");
XAxis labels = new XAxis();
labels.addLabels("北區", "中區", "南區", "離島");
cht.setXAxis(labels);
YAxis range = new YAxis();
range.setRange(0, 60, 10);
cht.setYAxis(range);
BarChart bar = new BarChart(BarChart.Style.THREED);
LineChart lin = new LineChart();
bar.setColour("#669900");
lin.setColour("#6666FF");
bar.setText("存貨量");
lin.setText("價格");
for(int i=0; i<4; i++) {
bar.addValues((int) (Math.random() * 60) + 1);
lin.addValues((int) (Math.random() * 10) + 1);
}
cht.addElements(bar, lin);
out.println(cht.toString());
%>