|
|
|
@ -33,6 +33,8 @@ nv.models.scatterChart = function() {
|
|
|
|
|
, tooltipY = function(key, x, y) { return '<strong>' + y + '</strong>' }
|
|
|
|
|
//, tooltip = function(key, x, y) { return '<h3>' + key + '</h3>' }
|
|
|
|
|
, tooltip = null
|
|
|
|
|
, state = {}
|
|
|
|
|
, defaultState = null
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
|
|
|
|
|
, noData = "No Data Available."
|
|
|
|
|
;
|
|
|
|
@ -63,8 +65,7 @@ nv.models.scatterChart = function() {
|
|
|
|
|
// Private Variables
|
|
|
|
|
//------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
var state = {},
|
|
|
|
|
x0, y0;
|
|
|
|
|
var x0, y0;
|
|
|
|
|
|
|
|
|
|
var showTooltip = function(e, offsetElement) {
|
|
|
|
|
//TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?)
|
|
|
|
@ -109,6 +110,16 @@ nv.models.scatterChart = function() {
|
|
|
|
|
//set state.disabled
|
|
|
|
|
state.disabled = data.map(function(d) { return !!d.disabled });
|
|
|
|
|
|
|
|
|
|
if (!defaultState) {
|
|
|
|
|
var key;
|
|
|
|
|
defaultState = {};
|
|
|
|
|
for (key in state) {
|
|
|
|
|
if (state[key] instanceof Array)
|
|
|
|
|
defaultState[key] = state[key].slice(0);
|
|
|
|
|
else
|
|
|
|
|
defaultState[key] = state[key];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------
|
|
|
|
|
// Display noData message if there's nothing to show.
|
|
|
|
@ -149,10 +160,10 @@ nv.models.scatterChart = function() {
|
|
|
|
|
var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]);
|
|
|
|
|
var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id());
|
|
|
|
|
var gEnter = wrapEnter.append('g');
|
|
|
|
|
var g = wrap.select('g')
|
|
|
|
|
var g = wrap.select('g');
|
|
|
|
|
|
|
|
|
|
// background for pointer events
|
|
|
|
|
gEnter.append('rect').attr('class', 'nvd3 nv-background')
|
|
|
|
|
gEnter.append('rect').attr('class', 'nvd3 nv-background');
|
|
|
|
|
|
|
|
|
|
gEnter.append('g').attr('class', 'nv-x nv-axis');
|
|
|
|
|
gEnter.append('g').attr('class', 'nv-y nv-axis');
|
|
|
|
@ -565,6 +576,12 @@ nv.models.scatterChart = function() {
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.defaultState = function(_) {
|
|
|
|
|
if (!arguments.length) return defaultState;
|
|
|
|
|
defaultState = _;
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.noData = function(_) {
|
|
|
|
|
if (!arguments.length) return noData;
|
|
|
|
|
noData = _;
|
|
|
|
|