')
//.css('margin-right', '6px')
//.addClass('unit')
.text(this.options.unit)
.css('margin-top', '-10px')
.css('margin-left', '220px')
.appendTo(ul);
var gaugeDiv = $('
', {
'class': 'horizontal_graph_wrap'
//}).css('position', 'absolute')
}).css('position', 'relative')
.css('bottom', '70px')
//.css('margin-right', '10px');
.css('margin-left', '10px');
this.ratioDiv = $('
', {
'class': 'horizontal_graph_gage'
}).css('left', _minRatio + '%')
.appendTo(gaugeDiv);
this.element
.css('height', this.options.height)
.css('position', 'relative')
.css('display', 'inline-block')
.append(title)
.append(ul)
.append(gaugeDiv);
},
_setValue: function(value) {
var totalRatio = _maxRatio - _minRatio;
//var totalValue = this.options.maxValue - this.options.minValue;
//var v = (value / this.options.maxValue);
//var ratio = v * totalRatio - _minRatio;
var ratio = (value / this.options.maxValue) * 100;
if (ratio < _minRatio) {
ratio = _minRatio;
}
else if (_maxRatio < ratio) {
ratio = _maxRatio;
}
// this.options.value = value;
if (typeof (value) === 'function') {
value = value();
}
//value = String(value).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
//this.valueDiv.text(value + ' ' + this.options.unit);
//this.valueDiv.text((value)); // hcLee 2016 03 09 $NumberFormat 추가
this.valueDiv.text($NumberFormat(value));
if (ratio > 150) ratio = 150;
ratio = ratio * 1.33; // 150% 지만 이미지 pixcel크기는 200 이므로 비율을 맞춘다 /hcLee 2016 12 09
ratio -= 10; // 눈금이미지 폭의 반만큼왼쪽으로 이동
this.ratioDiv.css('left', ratio + 'px'); // '%'에서 픽셀로 수정 hcLee 2016 12 09
},
_refresh: function() {
},
_destroy: function() {
},
_setOption: function(key, value) {
switch (key) {
case 'value':
this._setValue(value);
break;
case 'unit':
this.unitDiv.text(value);
//this.unitDiv.text('XX');
//this.unitDiv.css('position', 'absolute')
//this.unitDiv.css('margin-right', '10px');
break;
}
this._super(key, value);
this._refresh();
},
_setOptions: function() {
this._superApply(arguments);
this._refresh();
},
});
function RateGauge(options) {
this.id = '#' + options.id;
$(this.id).cwGauge(options);
};
RateGauge.prototype.setValue2 = function (value,unit) {
$(this.id).cwGauge2(value, unit);
};
RateGauge.prototype.setValue = function(value) {
$(this.id).cwGauge('option', 'value', value);
};
RateGauge.prototype.setMaxValue = function(value) {
$(this.id).cwGauge('option', 'maxValue', value);
};
RateGauge.prototype.setUnit = function(value) {
$(this.id).cwGauge('option', 'unit', value);
};
BWA.Chart = BWA.Chart || {};
BWA.Chart.RateGauge = {};
BWA.Chart.RateGauge.newInstance = function(options) {
return new RateGauge(options);
};
});