Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
konstantin committed Jan 13, 2015
1 parent 1c46a0f commit 450643c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
18 changes: 12 additions & 6 deletions build/development/plugins/tauCharts.tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,21 @@

}
},

renderItem: function(field, value, rawValue){
return this._templateItem({
label: field,
value: value
});
},

render: function (data, fields) {
fields = _.unique(fields);
return fields.map(function (field) {
var v = data[field];
var value = (_.isNull(v) || _.isUndefined(v)) ? ('No ' + field) : v;
return this._templateItem({
label: field,
value: this._getFormatter(field)(value)
});
var rawValue = data[field];
var formattedValue = this._getFormatter(field)(rawValue);
var value = (_.isNull(formattedValue) || _.isUndefined(formattedValue)) ? ('No ' + field) : formattedValue;
return this.renderItem(field, value, rawValue);
}, this).join('');
},
onRender: function (chart) {
Expand Down
21 changes: 12 additions & 9 deletions build/development/plugins/tauCharts.trendline.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,18 @@
lines.enter().append('g').call(updateLines);
lines.exit().remove();
};

var isElement = function (unitMeta) {
return (unitMeta.type && unitMeta.type.indexOf('ELEMENT.') === 0);
};
var coordHasElements = function(units){
return _.any(units,function(unit){
return isElement(unit);
});
};
var isApplicable = function (dimensions) {
return function (unitMeta) {
var isElement = (unitMeta.type && unitMeta.type.indexOf('ELEMENT.') === 0);

if (!isElement) {
var hasElement = (unitMeta.type && unitMeta.type.indexOf('COORDS.') === 0 && coordHasElements(unitMeta.unit));
if (!hasElement) {
return false;
}
var x = dimensions[unitMeta.x].type;
Expand All @@ -284,7 +290,6 @@
return dimType && (dimType !== 'category');
});
};

};

var dfs = function (node, predicate) {
Expand All @@ -301,9 +306,7 @@
}
};

var isElement = function (unitMeta) {
return (unitMeta.type && unitMeta.type.indexOf('ELEMENT.') === 0);
};


function trendline(xSettings) {

Expand All @@ -321,7 +324,7 @@

this._chart = chart;
var conf = chart.getConfig();
this._isApplicable = dfs(conf.spec.unit,isApplicable(conf.dimensions));
this._isApplicable = dfs(conf.spec.unit,isApplicable(conf.spec.dimensions));

if (settings.showPanel) {

Expand Down
2 changes: 1 addition & 1 deletion build/production/tauCharts.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/scatter.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
width: 100%;
height: 640px;
}
/*.applicable-false {
.applicable-false {
display: none;
}*/
}

input {
width: 500px;
Expand Down Expand Up @@ -150,7 +150,7 @@
{x: "11", y: 2, type: false, t: 'x'},
{x: "12", y: 2, type: false, t: 'x'},
{x: "13", y: 2, type: false, t: 'x'},*/
{x: 13, y: 9, type: true, t: 'x'},
{x: 13, y: "9", type: true, t: 'x'},
{x: 13, y: 10, type: false, t: 'x'},
{x: 14, y: 15, type: false, t: 'x'},
];
Expand Down

0 comments on commit 450643c

Please sign in to comment.