こんにちは、特定の入力ボックスから系列値を取得し、グラフが自動的に変更されるような方法で Dojo グラフを作成する必要があります。
var showChart= function(){
var thevalue=dijit.byId('myvalue').get('value');//gets thevalue from the dijit numbertextbox
var chart1 = new dojox.charting.Chart2D("showgoals");
chart1.addPlot("default", {type: "Lines"});
chart1.addAxis("x");
chart1.addAxis("y", {vertical: true});
chart1.addSeries("Series 1", [thevalue, 2, 2, 3, 4, 5, 5, 7]);
chart1.render();};
次に、値が変更されるたびにこの関数を呼び出します:-
dojo.connect(dojo.byId('myvalue'), "onchange",showChart);//whenever value changes the showChart function
と呼ばれる
html は次のようになります。
<div dojoType="dijit.layout.ContentPane" region="center">
<div id="showgoals" style="width: 250px; height:150px;" class="graph1"></div>
以下は、値を変更するテキスト ボックスです。
<input id="myvalue" type="text" dojoType="dijit.form.NumberTextBox" name="myvalue"value="1000000" required="true"
invalidMessage="Only Numbers allowed"/><br/><br/>
私が望んでいたのは、この入力ボックスの値が変更されるたびに関数 showchart が呼び出され、現在のプロットが自動的に変更されて新しい値が表示されるようにすることでした。 . 古いチャートを破棄してから、新しいチャートを再作成する必要がありますか? もしそうなら、その方法を教えてください.