3

私は道場の縦棒グラフを使用しています。プロットに描画されるカスタム ライン (ある種のしきい値ライン) を追加したいと考えています。したがって、y 軸の範囲が 0 から 5 であるとしましょう。プロットを横切る 4.2 の水平線が必要です。縦棒グラフです。プロットでカスタム描画を行うのに役立つ描画 API を見つけたいと思っていましたが、その方法がわかりません。チャートが gfx とサーフェスを使用していることは知っているので、チャート/プロット サーフェスのハンドルを取得できれば、カスタム ラインを描画できますか? これを実現するには、座標マッピングをレンダリングするためのデータも必要です

私の現在のチャートは次のようなコードを使用しています:

var mychart = new dojox.charting.Chart2D("columns").
        addAxis("x", {fixLower: "minor", fixUpper: "minor", natural: true,
                            font: "normal normal 10pt Arial", 
                             labels: [{value: 1, text: "Q2 FY11"},
                                      {value: 2, text: "Q3 FY11"},
                                    {value: 3, text: "Q4 FY11"},
                                    {value: 4, text: "Q1 FY12"}]
                            }).
        addAxis("y", {vertical: true, includeZero: false, fixLower: "major", fixUpper: "major", min: 0, max: 5, font: "normal normal 10pt Arial", majorTick: {color: "black", length: 6}, minorTicks: false}).
        addPlot("default", {type: "ClusteredColumns", tension: "S", shadows: {dx: 2, dy: 2}, gap: 5, minBarSize : 14, maxBarSize:24, animate:  { duration: 1000, easing: dojo.fx.easing.linear} }).
        addSeries("Series A", [{ y: 2.3, tooltip: "FFFF"}, { y: 3.5, tooltip: "GGGG"}]).
        addSeries("Series B", [1.2, 2.5]);
4

3 に答える 3

3

別のプロットを使用して線をレンダリングできます。

new dojox.charting.Chart2D("columns").
    addAxis("x", {fixLower: "minor", fixUpper: "minor", natural: true,
                        font: "normal normal 10pt Arial", 
                         labels: [{value: 1, text: "Q2 FY11"},
                                  {value: 2, text: "Q3 FY11"},
                                {value: 3, text: "Q4 FY11"},
                                {value: 4, text: "Q1 FY12"}]
                        }).
    addAxis("y", {vertical: true, includeZero: false, fixLower: "major", fixUpper: "major", min: 0, max: 5, font: "normal normal 10pt Arial", majorTick: {color: "black", length: 6}, minorTicks: false}).
    addPlot("default", {type: "ClusteredColumns", tension: "S", shadows: {dx: 2, dy: 2}, gap: 5, minBarSize : 14, maxBarSize:24, animate:  { duration: 1000, easing: dojo.fx.easing.linear} }).
    addSeries("Series A", [{ y: 2.3, tooltip: "FFFF"}, { y: 3.5, tooltip: "GGGG"}]).
    addSeries("Series B", [1.2, 2.5]).
    addPlot("threshold", { type: "Lines" }).
    addSeries("threshold", [{x: 0, y: 4.2}, {x: 4, y: 4.2}], { plot: "threshold" }).
    render();
于 2012-03-29T13:16:24.617 に答える
1

同じチャートで max_temperature を線として、Min_temperature を列として表す別の簡単な例:

var chart = new Chart("chartNode");

chart.addPlot("tempMaxPlot", {
    type: "Lines",
    markers: false
});

chart.addPlot("tempMinPlot", {
    type: "Columns",
    markers: true,
    gap: 5
});

chart.addAxis("x");
chart.addAxis("y", { min: -3, max: 13, vertical: true, fixLower: "minor", fixUpper: "major" });

var chartData_tmax = [11,13,12,11,10,9,9,10];
chart.addSeries("tmax",chartData_tmax, { plot: "tempMaxPlot" });

var chartData_tmin = [1,1,2,1,0,-1,-1,0];
chart.addSeries("tmin",chartData_tmin, { plot: "tempMinPlot" });

chart.render();
于 2013-02-19T16:16:13.763 に答える