ChartExpert サンプル
以下のグラフのサンプルを示します。いずれも、ChartExpertのデモンストレーション画面から試してみることができます。
- 折れ線グラフ
- 縦棒グラフ
- 円グラフ
- 散布図
- マルチページ
折れ線グラフ
基本
(x,y)の値を結んで折れ線グラフを描きます。
xの値は等間隔である必要はありませんが、小さい順に整列されていなければなりません。
コマンド
_client=ChartExpert Demo _version=1 sample.y=20,22,25,30,28 sample.x=0,1,2,5,6 chart.type=line chart.dataset=sample chart.title=Sample Chart
サンプルプログラム
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("chart:///show"));
StringBuffer buf = new StringBuffer();
buf.append("_client=ChartExpert Demo\n");
buf.append("_version=1\n");
buf.append("sample.y=20,22,25,30,28\n");
buf.append("sample.x=0,1,2,5,6\n");
buf.append("chart.type=line\n");
buf.append("chart.dataset=sample\n");
buf.append("chart.title=Sample Chart\n");
intent.putExtra("content", buf.toString());
startActivity(intent);
バリエーション : 複合グラフ
複数のデータセットを1つの画面に表示することもできます。
y軸は、<CKEY>.datasetの最初に指定されているデータセットのものが使われます。
コマンド
_client=ChartExpert Demo _version=1 sample1.y=4,2,3,5,5,1 sample1.x=0,1,2,3,5,6 sample1.yaxis=0,10,1 sample2.y=1,5,7,5,3,6 sample2.x=0,1,2,3,4,5 chart.type=line chart.dataset=sample1,sample2
バリエーション : 戦略キャンバス
y軸ラベルに文字列を使用すると、戦略キャンバスやアンケート集計の描画応用することもできます。
コマンド
_client=ChartExpert Demo _version=1 sample.y=3,5,4,4,5,1,3,5 sample.x=0,1,2,3,4,5,6,7 sample.xlabel=speed,function,design,usability,price,response,variation,reputation sample.ylabel=very bad,bad,normal,good,very good sample.xaxis=0,7,1 sample.yaxis=1,5,1 chart.type=line chart.dataset=sample
縦棒グラフ
基本
(x,y)を縦棒グラフとして描きます。
xの値は横軸上の位置に使われます。等間隔である必要はありませんが、等間隔が望ましいでしょう。小さい順に整列されていなければなりません。省略するのが最善です。
コマンド
_client=ChartExpert Demo _version=1 sample.y=3,6,7,8,0,0,10,3 chart.type=vbar chart.dataset=sample
サンプルプログラム
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("chart:///show"));
StringBuffer buf = new StringBuffer();
buf.append("_client=ChartExpert Demo\n");
buf.append("_version=1\n");
buf.append("sample.y=3,6,7,8,0,0,10,3\n");
buf.append("chart.type=vbar\n");
buf.append("chart.dataset=sample\n");
intent.putExtra("content", buf.toString());
startActivity(intent);
バリエーション : 複合グラフ
コマンド
_client=ChartExpert Demo _version=1 sample1.y=3,6,7,8,0,0,10,3 sample2.y=1,2,3,4,5,6,7,8 sample3.y=3,10,0,0,8,7,6,3 chart.type=vbar chart.dataset=sample1,sample2,sample3
円グラフ
基本
yデータの値すべての合計を100%として円グラフを描きます。
xの値は使われません。
各扇形に添えられるラベルには、xlabelおよびlabelで指定した文字列が使われます。ylabelは使われません。
コマンド
_client=ChartExpert Demo _version=1 sample.y=500,800,200 sample.label=500,800,200 sample.xlabel=A,B,C chart.type=pie chart.dataset=sample chart.title=Sample Pie Chart
サンプルプログラム
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("chart:///show"));
StringBuffer buf = new StringBuffer();
buf.append("_client=ChartExpert Demo\n");
buf.append("_version=1\n");
buf.append("sample.y=500,800,200\n");
buf.append("sample.label=500,800,200\n");
buf.append("sample.xlabel=A,B,C\n");
buf.append("chart.type=pie\n");
buf.append("chart.dataset=sample\n");
buf.append("chart.title=Sample Pie Chart\n");
intent.putExtra("content", buf.toString());
startActivity(intent);
バリエーション : 項目が多い例
ChartExpertでは8色の基本色をグラフに使います。項目が多い場合は色にわずかな変化をつけて8色を繰り返し使います。
コマンド
_client=ChartExpert Demo _version=1 sample.y=500,800,200 sample.label=500,800,200 sample.xlabel=A,B,C chart.type=pie chart.dataset=sample chart.title=Sample Pie Chart
散布図
基本
(x,y)を点として描画し、散布図を描きます。
整列されている必要はありません。
xaxis,yaxisを定義することをおすすめします。
コマンド
_client=ChartExpert Demo _version=1 sample.y=-0.13,-1.05,-0.34,-0.12,-0.62,-0.28,-0.02,-0.16,-0.04,0.00,0.32,0.09,0.03,0.56,0.68,0.73,0.38,1.20,0.61 sample.x=-1.04,-0.71,-0.07,-0.44,-0.80,-0.20,-0.20,-0.06,-0.03,0.00,0.24,0.16,0.25,0.67,0.38,0.07,0.66,0.46,0.16 sample.xaxis=-1,1 chart.type=scatter chart.dataset=sample
サンプルプログラム
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("chart:///show"));
StringBuffer buf = new StringBuffer();
buf.append("_version=1\n");
buf.append("_client=ChartExpert Demo\n");
buf.append("sample.y=-0.13,-1.05,-0.34,-0.12,-0.62,-0.28,-0.02,-0.16,-0.04,0.00,0.32,0.09,0.03,0.56,0.68,0.73,0.38,1.20,0.61\n");
buf.append("sample.x=-1.04,-0.71,-0.07,-0.44,-0.80,-0.20,-0.20,-0.06,-0.03,0.00,0.24,0.16,0.25,0.67,0.38,0.07,0.66,0.46,0.16\n");
buf.append("sample.xaxis=-1,1\n");
buf.append("chart.type=scatter\n");
buf.append("chart.dataset=sample\n");
intent.putExtra("content", buf.toString());
startActivity(intent);
バリエーション : 複合
複数のデータセットを1つの画面に表示することもできます。
コマンド
_client=ChartExpert Demo _version=1 sample1.y=-0.13,-1.05,-0.34,-0.12,-0.62,-0.28,-0.02,-0.16,-0.04,0.00,0.32,0.09,0.03,0.56,0.68,0.73,0.38,1.20,0.61 sample1.x=-1.04,-0.71,-0.07,-0.44,-0.80,-0.20,-0.20,-0.06,-0.03,0.00,0.24,0.16,0.25,0.67,0.38,0.07,0.66,0.46,0.16 sample1.xaxis=-1,1 sample1.yaxis=-1,1 sample2.y=-1.05,-0.40,-1.17,-0.31,-0.02,-0.25,-0.02,-0.07,-0.02,0.00,0.01,0.09,0.06,0.05,0.19,0.92,1.01,0.42,1.25 sample2.x=-0.21,-0.47,-0.39,-0.11,-0.21,-0.51,-0.06,-0.10,-0.01,0.00,0.11,0.45,0.32,0.09,0.45,0.41,1.74,1.04,0.18 chart.type=scatter chart.dataset=sample1,sample2
マルチページ
チャートを2つ作り、ページ切り替えすることもできます。
<CKEY>を2種類作り、それぞれにデータセットを割り当てます。それぞれの<CKEY>に異なるグラフタイプを指定することもできます。
コマンド
_client=ChartExpert Demo _version=1 line.y=20,22,25,30,28 line.x=0,1,2,5,6 scatter.y=-1.05,-0.40,-1.17,-0.31,-0.02,-0.25,-0.02,-0.07,-0.02,0.00,0.01,0.09,0.06,0.05,0.19,0.92,1.01,0.42,1.25 scatter.x=-0.21,-0.47,-0.39,-0.11,-0.21,-0.51,-0.06,-0.10,-0.01,0.00,0.11,0.45,0.32,0.09,0.45,0.41,1.74,1.04,0.18 scatter.yaxis=-1,1 scatter.xaxis=-1,1 chart1.type=line chart1.dataset=line chart2.type=scatter chart2.dataset=scatter
サンプルプログラム
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("chart:///show"));
StringBuffer buf = new StringBuffer();
buf.append("_version=1\n");
buf.append("_client=ChartExpert Demo\n");
buf.append("line.y=20,22,25,30,28\n");
buf.append("line.x=0,1,2,5,6\n");
buf.append("scatter.y=-1.05,-0.40,-1.17,-0.31,-0.02,-0.25,-0.02,-0.07,-0.02,0.00,0.01,0.09,0.06,0.05,0.19,0.92,1.01,0.42,1.25\n");
buf.append("scatter.x=-0.21,-0.47,-0.39,-0.11,-0.21,-0.51,-0.06,-0.10,-0.01,0.00,0.11,0.45,0.32,0.09,0.45,0.41,1.74,1.04,0.18\n");
buf.append("scatter.yaxis=-1,1\n");
buf.append("scatter.xaxis=-1,1\n");
buf.append("chart1.type=line\n");
buf.append("chart1.dataset=line\n");
buf.append("chart2.type=scatter\n");
buf.append("chart2.dataset=scatter\n");
intent.putExtra("content", buf.toString());
startActivity(intent);









