私はこのような結果を得ています:
なぜ一体なぜ私はこの値を y 軸で取得しているので、これは奇妙です1 1 2 2 2
。私が持っている結果は
[[["2013-01-30", "2"], ["2013-01-31", "2"], ["2013-02-01", "1"]]]
私がここでやろうとしているのは、スクリーンショットのように、Y 軸を 1 が最高または一番上になるように反転させることです。
これが私のコードです:
私はajaxを介してjsonの結果でこれを取得しています。結果は次のとおりです。
[{"execution_datetime":"2013-01-30","sales_rank":"2"},{"execution_datetime":"2013-01-31","sales_rank":"2"},{"execution_datetime":"2013-02-01","sales_rank":"1"}]
、それは上のデータの結果ですjQuery.each
var response =[[]];
var maxSR = 1;
jQuery.each(data, function(index, value) {
if( this.sales_rank > maxSR ) {
maxSR = this.sales_rank; //I am getting the largest number in the response array so that I can assign it on the Y-AXIS MIN
}
response[0].push([this.execution_datetime, this.sales_rank]);
});
//response has already a value of:
//[[["2013-01-30", "2"], ["2013-01-31", "2"], ["2013-02-01", "1"]]]
var tmpMin = response[0][0];
var xMin = tmpMin[0];
var plot2 = $.jqplot('myChart',response,{
axes:{
xaxis:{
renderer:$.jqplot.DateAxisRenderer,
tickOptions:{formatString:'%b %#d'},
tickInterval:"1 days",
min: xMin,
},
yaxis:{
tickOptions:{ formatString:'%d' },
max:1,
min:parseInt(maxSR),
},
},
highlighter:{
show:true,
sizeAdjust: 7.5,
},
cursor: {
show:false,
},
});
また、y軸の を削除しようとしtickOptions:{ formatString:'%d' },
ましたが、うまくいっているようです。問題は、Y軸に気に入らないフロートがいくつかあることです。どうすればそれを解決できますか?
これが解決される場合の別の質問ですが、ポイントが境界線上にならないように、x 軸に一種のオフセットを設定することは可能ですか?
あなたの助けは大歓迎です! ありがとうございました!:)