y 축의 값을 정수로 만드는 방법은 무엇입니까?y 축 값을 jqplot에서만 정수로 표시하는 방법
현재이 값은 0.0 1.0 1.5 2.0 2.5 3.0입니다. 이걸 0 1 2 3 등으로 바꾸고 싶습니다 ....
고마워요! 건배!
y 축의 값을 정수로 만드는 방법은 무엇입니까?y 축 값을 jqplot에서만 정수로 표시하는 방법
현재이 값은 0.0 1.0 1.5 2.0 2.5 3.0입니다. 이걸 0 1 2 3 등으로 바꾸고 싶습니다 ....
고마워요! 건배!
내가 당신이 원하는 것을 이해한다면, Y 축 정수 값을 표시하는 것입니다
(너무 짧은 대답, 필러 텍스트) parseInt(y_axis)
을보십시오.
이 시도
,axesDefaults:
{
min: 0,
tickInterval: 1,
tickOptions: {
formatString: '%d'
}
}
무시 createTicks 기능과 새로운 축 부울 속성을 소개 - integersOnly합니다.
// jqplot adding integersOnly option for an axis
var oldCreateTicks = $.jqplot.LinearAxisRenderer.prototype.createTicks;
$.jqplot.LinearAxisRenderer.prototype.createTicks = function (plot) {
if (this.integersOnly == true) {
var db = this._dataBounds;
var min = ((this.min != null) ? this.min : db.min);
var max = ((this.max != null) ? this.max : db.max);
var range = max - min;
if (range < 3) {
if (this.min == null) {
this.min = 0;
}
this.tickInterval = 1;
}
}
return oldCreateTicks.apply(this, plot);
}
맨위로 답을 작성하십시오.
axes: {
yaxis: {
min: 0,
tickInterval: 1,
tickOptions: {
formatString: '%d'
}
}
}
그냥 yaxis에 적용합니다. 막 대형 차트 또는 다른 차트가 있고 축을 분리하려는 경우 유용합니다.
"tickOptions : formatString : '% d'"을 사용하여 훌륭하게 작동했습니다. –
이지만 y 축에 최대 1pt 인 경우 y 축에 o, 1,1을 표시합니다. – jbmyid