Browse Source

updated dataAxis and legend to also make use of the instance based groups.visiblilty option

v3_develop
Alex de Mulder 10 years ago
parent
commit
e1a2fb224d
6 changed files with 24564 additions and 24560 deletions
  1. +24538
    -24536
      dist/vis.js
  2. +1
    -1
      dist/vis.map
  3. +12
    -12
      dist/vis.min.js
  4. +4
    -3
      lib/timeline/component/DataAxis.js
  5. +5
    -4
      lib/timeline/component/Legend.js
  6. +4
    -4
      lib/timeline/component/LineGraph.js

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


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


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


+ 4
- 3
lib/timeline/component/DataAxis.js View File

@ -11,7 +11,7 @@ var DataStep = require('../DataStep');
* @extends Component
* @param body
*/
function DataAxis (body, options, svg) {
function DataAxis (body, options, svg, linegraphOptions) {
this.id = util.randomUUID();
this.body = body;
@ -33,6 +33,7 @@ function DataAxis (body, options, svg) {
}
};
this.linegraphOptions = linegraphOptions;
this.linegraphSVG = svg;
this.props = {};
this.DOMelements = { // dynamic elements
@ -161,7 +162,7 @@ DataAxis.prototype._redrawGroupIcons = function () {
for (var groupId in this.groups) {
if (this.groups.hasOwnProperty(groupId)) {
if (this.groups[groupId].visible == true) {
if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
this.groups[groupId].drawIcon(x, y, this.svgElements, this.svg, iconWidth, iconHeight);
y += iconHeight + iconOffset;
}
@ -222,7 +223,7 @@ DataAxis.prototype.redraw = function () {
var activeGroups = 0;
for (var groupId in this.groups) {
if (this.groups.hasOwnProperty(groupId)) {
if (this.groups[groupId].visible == true) {
if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
activeGroups++;
}
}

+ 5
- 4
lib/timeline/component/Legend.js View File

@ -5,7 +5,7 @@ var Component = require('./Component');
/**
* Legend for Graph2d
*/
function Legend(body, options, side) {
function Legend(body, options, side, linegraphOptions) {
this.body = body;
this.defaultOptions = {
enabled: true,
@ -23,6 +23,7 @@ function Legend(body, options, side) {
}
this.side = side;
this.options = util.extend({},this.defaultOptions);
this.linegraphOptions = linegraphOptions;
this.svgElements = {};
this.dom = {};
@ -105,7 +106,7 @@ Legend.prototype.redraw = function() {
var activeGroups = 0;
for (var groupId in this.groups) {
if (this.groups.hasOwnProperty(groupId)) {
if (this.groups[groupId].visible == true) {
if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
activeGroups++;
}
}
@ -158,7 +159,7 @@ Legend.prototype.redraw = function() {
var content = '';
for (var groupId in this.groups) {
if (this.groups.hasOwnProperty(groupId)) {
if (this.groups[groupId].visible == true) {
if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
content += this.groups[groupId].content + '<br />';
}
}
@ -182,7 +183,7 @@ Legend.prototype.drawLegendIcons = function() {
for (var groupId in this.groups) {
if (this.groups.hasOwnProperty(groupId)) {
if (this.groups[groupId].visible == true) {
if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
this.groups[groupId].drawIcon(x, y, this.svgElements, this.svg, iconWidth, iconHeight);
y += iconHeight + this.options.iconSpacing;
}

+ 4
- 4
lib/timeline/component/LineGraph.js View File

@ -162,15 +162,15 @@ LineGraph.prototype._create = function(){
// data axis
this.options.dataAxis.orientation = 'left';
this.yAxisLeft = new DataAxis(this.body, this.options.dataAxis, this.svg);
this.yAxisLeft = new DataAxis(this.body, this.options.dataAxis, this.svg, this.options.groups);
this.options.dataAxis.orientation = 'right';
this.yAxisRight = new DataAxis(this.body, this.options.dataAxis, this.svg);
this.yAxisRight = new DataAxis(this.body, this.options.dataAxis, this.svg, this.options.groups);
delete this.options.dataAxis.orientation;
// legends
this.legendLeft = new Legend(this.body, this.options.legend, 'left');
this.legendRight = new Legend(this.body, this.options.legend, 'right');
this.legendLeft = new Legend(this.body, this.options.legend, 'left', this.options.groups);
this.legendRight = new Legend(this.body, this.options.legend, 'right', this.options.groups);
this.show();
};

Loading…
Cancel
Save