renamed dispatch point**** to element*** to be consistent with the others, cleaned up scatter, line, and stacked area to utilize scatter's scales, fixed a couple of remaps
.filter(function(d){return!parseFloat(Math.round(d*100000)/1000000)})//this is because sometimes the 0 tick is a very small fraction, TODO: think of cleaner technique
d3.rebind(chart,scale,'domain','range','rangeBand','rangeBands');//these are also accessible by chart.scale(), but added common ones directly for ease of use
//d3.rebind(chart, scale, 'domain', 'range', 'rangRoundBands', 'rangeBands'); //would implement, but will break because domain and range won't return chart... will likelu implement later
z=d3.scale.sqrt(),//sqrt because point size is done by area, not radius
dispatch=d3.dispatch('pointClick','pointMouseover','pointMouseout'),//TODO: consider renaming to elementMouseove and elementMouseout for consistency
dispatch=d3.dispatch('elementClick','elementMouseover','elementMouseout'),//TODO: consider renaming to elementMouseove and elementMouseout for consistency
x0,y0,z0,
timeoutID;
functionchart(selection){
selection.each(function(data){
//var seriesData = data.map(function(d) {
//var seriesData = data.map(function(d) {
varseriesData=(xDomain&&yDomain&&sizeDomain)?[]:// if we know xDomain and yDomain and sizeDomain, no need to calculate.... if Size is constant remember to set sizeDomain to speed up performance
.filter(function(d){return!parseFloat(Math.round(d*100000)/1000000)})//this is because sometimes the 0 tick is a very small fraction, TODO: think of cleaner technique
.classed('zero',true);
@ -74,43 +71,29 @@ nv.models.axis = function() {
}
//TODO: orient, domain, and range could be rebind's... but then they won't return the chart component
d3.rebind(chart,scale,'domain','range','rangeBand','rangeBands');//these are also accessible by chart.scale(), but added common ones directly for ease of use
//d3.rebind(chart, scale, 'domain', 'range', 'rangRoundBands', 'rangeBands'); //would implement, but will break because domain and range won't return chart... will likelu implement later
clipRadius=function(){return25},// function to get the radius for point clips
xDomain,yDomain,sizeDomain;// Used to manually set the x and y domain, good to save time if calculation has already been made
varx=d3.scale.linear(),
y=d3.scale.linear(),
z=d3.scale.sqrt(),//sqrt because point size is done by area, not radius
dispatch=d3.dispatch('pointClick','pointMouseover','pointMouseout'),//TODO: consider renaming to elementMouseove and elementMouseout for consistency
vardispatch=d3.dispatch('elementClick','elementMouseover','elementMouseout'),//TODO: consider renaming to elementMouseove and elementMouseout for consistency
x0,y0,z0,
timeoutID;
functionchart(selection){
selection.each(function(data){
//var seriesData = data.map(function(d) {
varseriesData=(xDomain&&yDomain&&sizeDomain)?[]:// if we know xDomain and yDomain and sizeDomain, no need to calculate.... if Size is constant remember to set sizeDomain to speed up performance
//console.log('recalculating');
data.map(function(d){
returnd.values.map(function(d,i){
return{x:getX(d,i),y:getY(d,i),size:getSize(d,i)}
})
}),
availableWidth=width-margin.left-margin.right,
//var seriesData = data.map(function(d) {
varavailableWidth=width-margin.left-margin.right,
availableHeight=height-margin.top-margin.bottom;
//store old scales if they exist
@ -46,8 +39,6 @@ nv.models.scatter = function() {
//add series index to each data point for reference
// slight remap of the data for use in calculating the scales domains
varseriesData=(xDomain&&yDomain&&sizeDomain)?[]:// if we know xDomain and yDomain and sizeDomain, no need to calculate.... if Size is constant remember to set sizeDomain to speed up performance
data.map(function(d){
returnd.values.map(function(d,i){
return{x:getX(d,i),y:getY(d,i),size:getSize(d,i)}
})
});
//TODO: figure out the best way to deal with scales with equal MIN and MAX