Re: Живые индикаторы на pChart
Добавлено: Пт фев 21, 2014 5:02 pm
Переключаюсь на светлую тему - все ОК. На темной все плывет. Полез в s.php, там вроде стоит проверка темная/светлая тема. Что не так?
Код: Выделить всё
function state1(contid, objprop, title, refreshtime, type) {
this.contid = contid;
this.objprop = objprop;
this.title = title;
this.refreshtime = refreshtime;
this.type = type;
this.lenX = 50;
this.lenY = 28;
this.title_font = '11px Tahoma';
this.value_font = '26px Tahoma';
this.background = 'rgba(0, 0, 0, 1)';
this.color_title = 'rgba(220, 220, 220, 1)';
this.color_unknown = '#444444';
this.color = this.color_unknown;
this.int1 = 0; this.int1_color = this.color_unknown;
this.int2 = 0; this.int2_color = this.color_unknown;
// ------------ redraw
this.redraw = function() {
// Background
this.context.clearRect(0, 0, this.lenX, this.lenY);
this.context.fillStyle = this.background;
this.context.fillRect(0, 0, this.lenX, this.lenY);
this.color = this.color_unknown;
if (this.value = this.int1) {this.color = this.int1_color;}
if (this.value = this.int2) {this.color = this.int2_color;}
this.context.fillStyle = this.color;
this.context.textAlign = "center";
// Led
this.context.font = this.value_font;
if (this.type == 2) {
this.context.fillText('●', 34, 28);
} else {
this.context.fillRect(24, 17, 14, 7);
}
// Title
this.context.font = this.title_font;
this.context.fillStyle = this.color_title;
this.context.fillText(this.title, 25, 10, 80);
} // redraw()
this.init();
} // state1()
state1.prototype = new jsgraphics_alertobject;
Код: Выделить всё
<script language="javascript" type="text/javascript" src="/jsgraphics/jsgraphics.js"></script>
<script language="javascript" type="text/javascript" src="/jsgraphics/state2.js"></script>
<canvas id="stt1" width="50" height="28">Canvas not supported</canvas>
<script type="text/javascript">
st1 = new state1('stt1', 'Arduino.alive', 'MEGA', 20000, 1);
st1.int1 = 1; st1.int1_color = 'rgba(50, 200, 50, 1)'; // green
st1.int2 = 0; st1.int2_color = 'rgba(210, 160, 50, 1)'; // orange
st1.redraw();
</script>
Код: Выделить всё
<script language="javascript" type="text/javascript" src="/jsgraphics/jsgraphics.js"></script>
<script language="javascript" type="text/javascript" src="/jsgraphics/icon1.js"></script>
<canvas id="stt1" width="50" height="28">Canvas not supported</canvas>
<script type="text/javascript">
st1 = new state1('stt1', 'Garag.enabled', 'MEGA', 20000, 1);
st1.int1 = 1; st1.int1_color = 'rgba(50, 200, 50, 1)'; // green
st1.int2 = 0; st1.int2_color = 'rgba(210, 160, 50, 1)'; // orange
st1.redraw();
</script>