Exportメソッドの同期化【Javaチャート・グラフ作成ツールEspressChart】


Q)下記の条件でEspressChartを使用して、WebアプリケーションでJSPファイル上でEspressChartのグラフ(PNG形式)を表示しようとしたところ、グラフが表示されない場合がある。(かわりに「×」が表示される)

1.グラフの生成をAPIのみで作成している。
2.chtファイルなどのグラフエディタで生成したファイルは使用していない。
3.データは文字列の配列として生成しAPIに渡している。
4.exportしてpngファイルを生成。
5.export時はOutputStreamを使用。

A)基本的にはQbChartクラスのexportメソッドはJSPファイルに対して、非同期で動作しています。

解決方法:

EspressChartではchtファイルを使用することを推奨していますが、そうでないときは次のの2つが考えられます。

1)アプリケーション側で画像が作成されたかチェックする仕組みを作成する。

2) One does not have to use .cht file. EspressChart can be split into two parts, like the enclosed E21.java
The first part get data and create the chart with QbChart(), the second part use chart.export() to generate the PNG file. The API lines such as
IDataPointSet hDataPoints = chart.gethDataPoints();
hDataPoints.setColors(color);
Cannot be sychronized individually as it was not executed sequentially but as part of the QbChart().
Most of the time is spent on chart.export (it takes seconds on PC and cannot be broken apart) and you may add java lines before or after to sychronize with your foreground.

関連するトピックス:

コメントを残す

メールアドレスが公開されることはありません。

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください