Browse Source

add styles option back for data points

It was implemented in commit 4e6c5a5 and accidentally deleted in commit
f39c246.
webworkersNetwork
Andrei Sedoi 9 years ago
parent
commit
4ac55e99af
3 changed files with 19 additions and 17 deletions
  1. +2
    -2
      lib/DOMutil.js
  2. +2
    -1
      lib/timeline/component/GraphGroup.js
  3. +15
    -14
      lib/timeline/component/graph2d_types/points.js

+ 2
- 2
lib/DOMutil.js View File

@ -149,8 +149,8 @@ exports.drawPoint = function(x, y, groupTemplate, JSONcontainer, svgContainer, l
point.setAttributeNS(null, "height", groupTemplate.size); point.setAttributeNS(null, "height", groupTemplate.size);
} }
if (groupTemplate.style !== undefined) {
point.setAttributeNS(null, "style", groupTemplate.style);
if (groupTemplate.styles !== undefined) {
point.setAttributeNS(null, "style", groupTemplate.styles);
} }
point.setAttributeNS(null, "class", groupTemplate.className + " vis-point"); point.setAttributeNS(null, "class", groupTemplate.className + " vis-point");
//handle label //handle label

+ 2
- 1
lib/timeline/component/GraphGroup.js View File

@ -75,7 +75,7 @@ GraphGroup.prototype.setOptions = function(options) {
onRender: options.drawPoints onRender: options.drawPoints
} }
} }
util.mergeOptions(this.options, options,'interpolation'); util.mergeOptions(this.options, options,'interpolation');
util.mergeOptions(this.options, options,'drawPoints'); util.mergeOptions(this.options, options,'drawPoints');
util.mergeOptions(this.options, options,'shaded'); util.mergeOptions(this.options, options,'shaded');
@ -171,6 +171,7 @@ GraphGroup.prototype.drawIcon = function(x, y, JSONcontainer, SVGcontainer, icon
if (this.options.drawPoints.enabled == true) { if (this.options.drawPoints.enabled == true) {
var groupTemplate = { var groupTemplate = {
style: this.options.drawPoints.style, style: this.options.drawPoints.style,
styles: this.options.drawPoints.styles,
size:this.options.drawPoints.size, size:this.options.drawPoints.size,
className: this.className className: this.className
}; };

+ 15
- 14
lib/timeline/component/graph2d_types/points.js View File

@ -35,8 +35,8 @@ Points.draw = function (dataset, group, framework, offset) {
for (var i = 0; i < dataset.length; i++) { for (var i = 0; i < dataset.length; i++) {
if (!callback) { if (!callback) {
// draw the point the simple way.
DOMutil.drawPoint(dataset[i].x + offset, dataset[i].y, getGroupTemplate(), framework.svgElements, framework.svg, dataset[i].label);
// draw the point the simple way.
DOMutil.drawPoint(dataset[i].x + offset, dataset[i].y, getGroupTemplate(), framework.svgElements, framework.svg, dataset[i].label);
} }
else { else {
var callbackResult = callback(dataset[i], group, framework); // result might be true, false or an object var callbackResult = callback(dataset[i], group, framework); // result might be true, false or an object
@ -47,26 +47,27 @@ Points.draw = function (dataset, group, framework, offset) {
} }
function getGroupTemplate(callbackResult) { function getGroupTemplate(callbackResult) {
callbackResult = (typeof callbackResult === 'undefined') ? {} : callbackResult;
return {
style: callbackResult.style || group.options.drawPoints.style,
size: callbackResult.size || group.options.drawPoints.size,
className: callbackResult.className || group.className
};
callbackResult = (typeof callbackResult === 'undefined') ? {} : callbackResult;
return {
style: callbackResult.style || group.options.drawPoints.style,
styles: callbackResult.styles || group.options.drawPoints.styles,
size: callbackResult.size || group.options.drawPoints.size,
className: callbackResult.className || group.className
};
} }
function getCallback() { function getCallback() {
var callback = undefined;
var callback = undefined;
// check for the graph2d onRender // check for the graph2d onRender
if (framework.options.drawPoints.onRender && typeof framework.options.drawPoints.onRender == 'function') { if (framework.options.drawPoints.onRender && typeof framework.options.drawPoints.onRender == 'function') {
callback = framework.options.drawPoints.onRender;
callback = framework.options.drawPoints.onRender;
} }
// override it with the group onRender if defined // override it with the group onRender if defined
if (group.group.options && group.group.options.drawPoints && group.group.options.drawPoints.onRender && typeof group.group.options.drawPoints.onRender == 'function') { if (group.group.options && group.group.options.drawPoints && group.group.options.drawPoints.onRender && typeof group.group.options.drawPoints.onRender == 'function') {
callback = group.group.options.drawPoints.onRender;
callback = group.group.options.drawPoints.onRender;
} }
return callback; return callback;
} }
}; };

Loading…
Cancel
Save