added channel type dependend rendering as proposed by jahir

This commit is contained in:
Steffen Vogel 2011-03-17 11:01:19 +01:00
parent 98300a7aa0
commit b886d84802
3 changed files with 15 additions and 16 deletions

View file

@ -106,7 +106,6 @@
<td>
<label for="render-points"><input type="radio" id="render-points" name="render" value="points" /> Punkte</label>&nbsp;
<label for="render-lines"><input type="radio" id="render-lines" name="render" value="lines" /> Linien</label>
<label for="render-steps"><input type="radio" id="render-steps" name="render" value="steps" /> Stufen</label>
</td>
</tr>
<tr>

View file

@ -30,7 +30,7 @@ vz.options = {
backendUrl: '../backend.php', // TODO default backend, store backend urls in cookies
tuples: 300,
precission: 2, // TODO update from backend capabilities?
render: 'steps',
render: 'lines',
refresh: false,
defaultInterval: 24*60*60*1000, // 1 day
timezoneOffset: -(new Date().getTimezoneOffset() * 60000) // TODO add option with timezone dropdown
@ -39,10 +39,8 @@ vz.options = {
vz.options.plot = {
colors: ['#579D1C', '#7E0021', '#FFD320', '#FF420E', '#004586', '#0084D1', '#C5000B', '#FF950E', '#4B1F6F', '#AECF00', '#314004', '#83CAFF'],
series: {
lines: { show: true },
shadowSize: 0,
points: {
show: false,
radius: 1,
//symbol: 'square'
symbol: function(ctx, x, y, radius, shadow) { // just draw simple pixels

View file

@ -102,7 +102,6 @@ vz.wui.init = function() {
// plot rendering
$('#render-lines').attr('checked', (vz.options.render == 'lines'));
$('#render-points').attr('checked', (vz.options.render == 'points'));
$('#render-steps').attr('checked', (vz.options.render == 'steps'));
$('input[name=render][type=radio]').change(function() {
if ($(this).attr('checked')) {
vz.options.render = $(this).val();
@ -511,29 +510,32 @@ vz.entities.loadData = function() {
vz.wui.drawPlot = function () {
vz.wui.updateHeadline();
var data = new Array;
var series = new Array;
vz.entities.each(function(entity) {
if (entity.active && entity.data && entity.data.tuples && entity.data.tuples.length > 0) {
data.push({
var serie = {
data: entity.data.tuples,
color: entity.color
});
color: entity.color,
lines: {
show: (vz.options.render == 'lines'),
steps: (entity.definition.interpreter == 'Volkszaehler\\Interpreter\\MeterInterpreter')
},
points: { show: (vz.options.render == 'points') }
};
series.push(serie);
}
});
if (data.length == 0) {
if (series.length == 0) {
$('#overlay').html('<img src="images/empty.png" alt="no data..." /><p>nothing to plot...</p>');
data.push({}); // add empty dataset to show axes
series.push({}); // add empty dataset to show axes
}
else {
$('#overlay').empty();
}
vz.options.plot.series.lines.show = (vz.options.render == 'lines' || vz.options.render == 'steps');
vz.options.plot.series.lines.steps = (vz.options.render == 'steps');
vz.options.plot.series.points.show = (vz.options.render == 'points');
vz.plot = $.plot($('#flot'), data, vz.options.plot);
vz.plot = $.plot($('#flot'), series, vz.options.plot);
};
/*