Browse Source

bugfix for graph2d, updated example 15

v3_develop
Alex de Mulder 10 years ago
parent
commit
b3c733b751
5 changed files with 25238 additions and 25426 deletions
  1. +25221
    -25419
      dist/vis.js
  2. +1
    -1
      dist/vis.min.css
  3. +12
    -3
      examples/graph2d/15_streaming_data.html
  4. +3
    -3
      lib/timeline/DataStep.js
  5. +1
    -0
      lib/timeline/component/DataAxis.js

+ 25221
- 25419
dist/vis.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/vis.min.css
File diff suppressed because it is too large
View File


+ 12
- 3
examples/graph2d/15_streaming_data.html View File

@ -40,8 +40,16 @@
// create a graph2d with an (currently empty) dataset
var container = document.getElementById('visualization');
var dataset = new vis.DataSet();
var now = vis.moment();
// added initial set so you don't think the graph is empty
dataset.add({x: now-2000,y: y((now-2000) / 1000)});
dataset.add({x: now-1000,y: y((now-1000) / 1000)});
dataset.add({x: now,y: y((now) / 1000)});
dataset.add({x: now+1000,y: y((now+1000) / 1000)});
var options = {
start: vis.moment().add(-60, 'seconds'),
start: vis.moment().add(-30, 'seconds'), // changed so its faster
end: vis.moment(),
dataAxis: {
customRange: {
@ -93,15 +101,16 @@
// add a new data point to the dataset
var now = vis.moment();
dataset.add({
x: now,
x: now+2000, // changed so you dont see them appearing
y: y(now / 1000)
});
// remove all data points which are no longer visible
var range = graph2d.getWindow();
var interval = range.end - range.start;
var oldIds = dataset.getIds({
filter: function (item) {
return item.x < range.start;
return item.x < range.start - interval; // changed so you don't see them disappearing
}
});
dataset.remove(oldIds);

+ 3
- 3
lib/timeline/DataStep.js View File

@ -59,9 +59,9 @@ DataStep.prototype.setRange = function(start, end, minimumStep, containerHeight,
this._start = customRange.min === undefined ? start : customRange.min;
this._end = customRange.max === undefined ? end : customRange.max;
if (start == end) {
this._start = start - 0.75;
this._end = end + 1;
if (this._start == this._end) {
this._start -= 0.75;
this._end += 1;
}
if (this.autoScale) {

+ 1
- 0
lib/timeline/component/DataAxis.js View File

@ -296,6 +296,7 @@ DataAxis.prototype._redrawLabels = function () {
// calculate range and step (step such that we have space for 7 characters per label)
var minimumStep = this.master ? this.props.majorCharHeight || 10 : this.stepPixelsForced;
var step = new DataStep(this.range.start, this.range.end, minimumStep, this.dom.frame.offsetHeight, this.options.customRange[this.options.orientation]);
this.step = step;
// get the distance in pixels for a step

Loading…
Cancel
Save