Compare commits

..

No commits in common. 'master' and 'v0.9' have entirely different histories.
master ... v0.9

3
.gitignore vendored

@ -22,6 +22,3 @@ _site
ehthumbs.db
Icon?
Thumbs.db
# nodejs packages #
######################
node_modules

@ -1,3 +0,0 @@
{
"asi": true
}

@ -1,106 +0,0 @@
module.exports = function(grunt) {
//Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ''
},
dist: {
src: [
'src/intro.js',
'src/core.js',
'src/interactiveLayer.js',
'src/tooltip.js',
'src/utils.js',
'src/models/axis.js',
'src/models/historicalBar.js',
'src/models/bullet.js',
'src/models/bulletChart.js',
'src/models/cumulativeLineChart.js',
'src/models/discreteBar.js',
'src/models/discreteBarChart.js',
'src/models/distribution.js',
'src/models/historicalBar.js',
'src/models/historicalBarChart.js',
'src/models/indentedTree.js',
'src/models/legend.js',
'src/models/line.js',
'src/models/lineChart.js',
'src/models/linePlusBarChart.js',
'src/models/lineWithFocusChart.js',
'src/models/linePlusBarWithFocusChart.js',
'src/models/multiBar.js',
'src/models/multiBarChart.js',
'src/models/multiBarHorizontal.js',
'src/models/multiBarHorizontalChart.js',
'src/models/multiChart.js',
'src/models/ohlcBar.js',
'src/models/pie.js',
'src/models/pieChart.js',
'src/models/scatter.js',
'src/models/scatterChart.js',
'src/models/scatterPlusLineChart.js',
'src/models/sparkline.js',
'src/models/sparklinePlus.js',
'src/models/stackedArea.js',
'src/models/stackedAreaChart.js',
'src/outro.js'
],
dest: 'nv.d3.js'
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */'
},
js: {
files: {
'nv.d3.min.js': ['nv.d3.js']
}
}
},
jshint: {
foo: {
src: "src/**/*.js"
},
options: {
jshintrc: '.jshintrc'
}
},
watch: {
js: {
files: ["src/**/*.js"],
tasks: ['concat']
}
},
copy: {
css: {
files: [
{ src: 'src/nv.d3.css', dest: 'nv.d3.css' }
]
}
},
cssmin: {
dist: {
files: {
'nv.d3.min.css' : ['nv.d3.css']
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.registerTask('default', ['concat', 'copy']);
grunt.registerTask('production', ['concat', 'uglify', 'copy', 'cssmin']);
grunt.registerTask('release', ['production']);
grunt.registerTask('lint', ['jshint']);
};

@ -1,18 +1,16 @@
JS_FILES = \
src/intro.js \
src/core.js \
src/interactiveLayer.js \
src/tooltip.js \
src/utils.js \
src/models/axis.js \
src/models/historicalBar.js \
src/models/bullet.js \
src/models/bulletChart.js \
src/models/cumulativeLineChart.js \
src/models/discreteBar.js \
src/models/discreteBarChart.js \
src/models/distribution.js \
src/models/historicalBar.js \
src/models/historicalBarChart.js \
src/models/indentedTree.js \
src/models/legend.js \
src/models/line.js \
@ -36,37 +34,23 @@ JS_FILES = \
src/models/stackedArea.js \
src/models/stackedAreaChart.js \
src/outro.js
CSS_FILES = \
src/nv.d3.css
JS_COMPILER = \
uglifyjs
CSS_COMPILER = \
cssmin
all: nv.d3.js nv.d3.min.js nv.d3.css nv.d3.min.css
all: nv.d3.js nv.d3.min.js
nv.d3.js: $(JS_FILES)
nv.d3.min.js: $(JS_FILES)
nv.d3.css: $(CSS_FILES)
nv.d3.min.css: $(CSS_FILES)
nv.d3.js: Makefile
rm -f $@
cat $(filter %.js,$^) >> $@
nv.d3.css: Makefile
rm -f $@
cat $(filter %.css,$^) >> $@
%.min.js:: Makefile
rm -f $@
$(JS_COMPILER) nv.d3.js >> $@
cat $(filter %.js,$^) | $(JS_COMPILER) >> $@
%.min.css:: Makefile
rm -f $@
$(CSS_COMPILER) nv.d3.css >> $@
clean:
rm -rf nv.d3.js nv.d3.min.js
clean:
rm -rf nv.d3*.js nv.d3*.css

@ -1,87 +1,53 @@
# NVD3 - v1.1.15-beta
## Release notes for version 1.1.15 beta
* Various fixes across the board
Please see Novus' official statement on nvd3 with an explanation,
apology, and commitment to its permanent status as an open-source
project.
[http://nvd3.org/statement.html](http://nvd3.org/statement.html)
## Overview
A reusable chart library for d3.js.
# nvd3 - v0.0.1
NVD3 may change from its current state, but will always try to follow the style of d3.js.
A reusable chart library for d3.JS.
You can also check out the [examples page](http://nvd3.org/ghpages/examples.html).
**Note:** The examples on nvd3.org are outdated. For examples on how to use the latest NVD3, please checkout the **examples/** directory in the repository.
Currently in an early stage of development, but will be a very active project. It may change quite a bit from its current state, but will always try to follow the style in which d3.js was done.
---
# Current development focus
- Getting documentation up.
- Unifying common API functions between charts.
- Bug fixes that come up.
You can also check out the [examples page](http://nvd3.org/ghpages/examples.html)
---
# Installation Instructions
# Current Improvement focus
`d3.v3.js` is a dependency of `nv.d3.js`. Be sure to include in in your project, then:
Add a script tag to include `nv.d3.js` OR `nv.d3.min.js` in your project.
Also add a link to the `nv.d3.css` file.
See wiki -> Documentation for more detail
Upgrade to d3.v3 in progress!
---
If one of [the existing models](https://github.com/novus/nvd3/tree/master/src/models) doesn't meet your needs, fork the project, implement the model and an example using it, send us a pull request, for consideration for inclusion in the project.
We cannot honor all pull requests, but we will review all of them.
Please do not aggregate pull requests. Aggregated pull requests are actually more difficult to review.
Please do not aggregate pull requests. Aggregated pull requests are actually more difficult to review!
We are currently changing our branch structure so that master will be gauranteed stable. In addition, there is now a "development" branch. This branch reflects the latest changes to NVD3 and is not necessarily stable.
We are currently changing our branch structure so that master will be gauranteed stable. In addition, there is now a "development" branch. This branch reflects the latest changes to nvd3 and is not necessarily stable.
---
## Minifying your fork:
Minifying your fork:
### Using Make
The Makefile requires [UglifyJS](https://github.com/mishoo/UglifyJS) and [CSSMin](https://github.com/jbleuzen/node-cssmin)
The Makefile requires [UglifyJS](https://github.com/mishoo/UglifyJS).
The easiest way to install UglifyJS and CSSMin is via npm. Run `npm install -g uglify-js cssmin`. After installing verify the setup by running `uglifyjs --version` and `cssmin --help`.
The easiest way to install is to install via npm. Run `npm install
uglify-js` from your home directory, then add the output from `npm bin`
into your path so that you have access to `uglifyjs` from the command
line (remember to restart your terminal window when adding to the path.)
Once you have the `uglifyjs` and `cssmin` commands available, running `make` from your
Once you have `uglifyjs` command available, running `make` from your
fork's root directory will rebuild both `nv.d3.js` and `nv.d3.min.js`.
make # build nv.d3.js and nv.d3.css and minify
make nv.d3.js # Build nv.d3.js
make nv.d3.min.js # Minify nv.d3.js into nv.d3.min.js
make nv.d3.css # Build nv.d3.css
make nv.d3.min.css # Minify nv.d3.css into nv.d3.min.css
make clean # Delete nv.d3.*js and nv.d3.*css
*Without UglifyJS or CSSMin, you won't get the minified versions when running make.**
### Using Grunt
You can use grunt instead of makefile to build js file. See more about [grunt](http://gruntjs.com/).
***[Nodejs](http://nodejs.org/) must be installed before you can use grunt.***
Run `npm install` in root dir to install grunt and it's dependencies.
Then, you can use these commands:
grunt # build nv.d3.js
grunt production # build nv.d3.js and nv.d3.min.js
grunt watch # watch file changes in src/, and rebuild nv.d3.js, it's very helpful when delevop NVD3
grunt lint # run jshint on src/**/*.js
Without UglifyJS, you won't get the minified version when running make.
**We ask that you DO NOT minify pull requests...
**We ask that you DO NOT minify pull requests...
If you need to minify please build pull request in separate branch, and
merge and minify in your master.
## Supported Browsers
NVD3 runs best on WebKit based browsers.
## (Officially) Supported Browsers
* **Google Chrome: latest version (preferred)**
* **Opera 15+ (preferred)**
* Safari: latest version
* Firefox: latest version
* Internet Explorer: 9 and 10
* Chrome latest version (preferred)
* Firefox latest version
* Safari latest version
* Internet Explorer 9 and 10

@ -1,35 +0,0 @@
{
"name": "nvd3",
"version": "1.1.15-beta",
"homepage": "http://www.nvd3.org",
"authors": [
"Bob Monteverde",
"Tyler Wolf",
"Robin Hu",
"Frank Shao"
],
"description": "Re-usable charts and chart components for d3.",
"main": ["nv.d3.js", "src/nv.d3.css"],
"keywords": [
"d3",
"visualization",
"svg",
"charts"
],
"license": "Apache License, v2.0",
"dependencies": {
"d3": "~3.3.13"
},
"ignore" : [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests",
"src/models/*",
"src/*.js",
"lib",
"examples",
"deprecated"
]
}

@ -1,3 +1,4 @@
nv.models.scatterChart = function() {
var margin = {top: 30, right: 20, bottom: 50, left: 60},
width = null,
@ -53,7 +54,7 @@ nv.models.scatterChart = function() {
that = this;
//TODO: decide if this makes sense to add into all the models for ease of updating (updating without needing the selection)
chart.update = function() { container.transition().call(chart) };
chart.update = function() { selection.transition().call(chart) };
var availableWidth = (width || parseInt(container.style('width')) || 960)
@ -168,8 +169,8 @@ nv.models.scatterChart = function() {
return d;
});
}
chart.update();
selection.transition().call(chart)
});
/*

@ -14,9 +14,8 @@ body {
<div class="gallery" id="chart"></div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/models/bullet.js"></script>
<script>

@ -5,7 +5,6 @@
body {
overflow-y:scroll;
font-family: Arial;
}
</style>
@ -13,15 +12,10 @@ body {
<br> <br> <br> <br> <br>
Normal Bullet Chart
<div class="gallery with-transitions" id="chart"></div>
<div class="gallery" id="chart"></div>
Bullet Chart with Custom Labels
<div class='gallery with-transitions' id='chart2'></div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/models/bullet.js"></script>
<script src="../src/models/bulletChart.js"></script>
<script>
@ -34,9 +28,6 @@ var chart = nv.models.bulletChart()
.width(width - margin.right - margin.left)
.height(height - margin.top - margin.bottom);
var chart2 = nv.models.bulletChart()
.width(width - margin.right - margin.left)
.height(height - margin.top - margin.bottom);
data = [
{"title":"Revenue","subtitle":"US$, in thousands","ranges":[150,225,300],"measures":[220],"markers":[250]}
@ -50,18 +41,13 @@ var chart2 = nv.models.bulletChart()
*/
];
dataWithLabels = [
{"title":"Revenue","subtitle":"US$, in thousands","ranges":[150,225,300],"measures":[220],"markers":[250],
"rangeLabels":['Maximum Inventory','Average Inventory','Minimum Inventory'], "measureLabels":['Current Inventory'], "markerLabels":['Target Inventory'] }
];
//TODO: to be consistent with other models, should be appending a g to an already made svg, not creating the svg element
var vis = d3.select("#chart").selectAll("svg")
.data(data)
.enter().append("svg")
.attr("class", "bullet nvd3")
.attr("width", width)
.attr("height", height);
.attr("height", height)
vis
.transition()
@ -69,29 +55,21 @@ dataWithLabels = [
.call(chart);
var vis2 = d3.select("#chart2").selectAll("svg")
.data(dataWithLabels)
.enter().append('svg')
.attr('class',"bullet nvd3")
.attr("width",width)
.attr("height",height);
vis2.transition().duration(1000).call(chart2);
window.transition = function() {
vis.datum(randomize)
.transition()
.duration(1000)
.call(chart);
vis.datum(randomize);
vis2.datum(randomize)
vis
.transition()
.duration(1000)
.call(chart2);
.call(chart);
};
function randomize(d) {
if (!d.randomizer) d.randomizer = randomizer(d);
d.ranges = d.ranges.map(d.randomizer);

@ -36,7 +36,7 @@ svg {
<svg style="height: 500px;"></svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../lib/crossfilter.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>

@ -36,7 +36,7 @@ svg {
<svg style="height: 500px;"></svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../lib/crossfilter.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>

@ -45,7 +45,7 @@ svg {
<div><h1>Stream #3</h1></div>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../lib/crossfilter.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>

@ -13,9 +13,12 @@ text {
font: 12px sans-serif;
}
svg {
display: block;
}
.chart svg {
height: 450px;
#chart1 svg {
height: 500px;
min-width: 100px;
min-height: 100px;
/*
@ -28,26 +31,15 @@ text {
</style>
<body>
<div class='navigation'>
Tests:
<a href="../test/lineChartTest.html">Line Chart</a>
<a href="../test/stackedAreaChartTest.html">Stacked Area</a>
<a href="cumulativeLineChart.html">Cumulative Line</a>
</div>
<div id="chart1" class='chart with-transitions'>
<strong>Chart with new tooltips and guide line (with-transitions)</strong>
<svg></svg>
</div>
<div id="chart2" class='chart with-transitions'>
<strong>Chart with old tooltips (with-transitions)</strong>
<svg></svg>
<div id="chart1">
<svg style="height: 500px;"></svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/interactiveLayer.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/axis.js"></script>
<script src="../src/models/scatter.js"></script>
@ -57,62 +49,34 @@ text {
// Wrapping in nv.addGraph allows for '0 timeout render', stores rendered charts in nv.graphs, and may do more in the future... it's NOT required
var chart;
nv.addGraph(function() {
var chart = nv.models.cumulativeLineChart()
.useInteractiveGuideline(true)
chart = nv.models.cumulativeLineChart()
.x(function(d) { return d[0] })
.y(function(d) { return d[1]/100 })
.color(d3.scale.category10().range())
.average(function(d) { return d.mean/100; })
.transitionDuration(300)
.clipVoronoi(false);
chart.xAxis
.tickFormat(function(d) {
return d3.time.format('%m/%d/%y')(new Date(d))
return d3.time.format('%x')(new Date(d))
});
chart.yAxis
.tickFormat(d3.format(',.1%'));
d3.select('#chart1 svg')
// .datum(cumulativeTestData())
.datum(cumulativeTestData())
//.transition().duration(500)
.call(chart);
//TODO: Figure out a good way to do this automatically
nv.utils.windowResize(chart.update);
//nv.utils.windowResize(function() { d3.select('#chart1 svg').call(chart) });
chart.dispatch.on('stateChange', function(e) { nv.log('New State:', JSON.stringify(e)); });
return chart;
});
nv.addGraph(function() {
var chart = nv.models.cumulativeLineChart()
.useInteractiveGuideline(false)
.rightAlignYAxis(true)
.margin({right:90})
.x(function(d) { return d[0] })
.y(function(d) { return d[1]/100 })
.color(d3.scale.category10().range())
.average(function(d) { return d.mean/100; })
.clipVoronoi(false);
chart.xAxis
.tickFormat(function(d) {
return d3.time.format('%m/%d/%y')(new Date(d))
});
chart.yAxis
.tickFormat(d3.format(',.1%'));
d3.select('#chart2 svg')
.datum(cumulativeTestData())
.call(chart);
//TODO: Figure out a good way to do this automatically
nv.utils.windowResize(chart.update);
chart.dispatch.on('stateChange', function(e) { nv.log('New State:', JSON.stringify(e)); });

@ -36,7 +36,7 @@ svg {
<svg></svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<!-- including all the components so I don't have to minify every time I test in development -->
<script src="../src/tooltip.js"></script>
@ -101,11 +101,10 @@ nv.addGraph(function() {
//.staggerLabels(historicalBarChart[0].values.length > 8)
.tooltips(false)
.showValues(true)
.transitionDuration(250)
;
d3.select('#chart1 svg')
.datum(historicalBarChart)
.transition().duration(500)
.call(chart);
nv.utils.windowResize(chart.update);

@ -16,7 +16,7 @@ text {
<svg id="test1"></svg>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/models/historicalBar.js"></script>
<script src="../src/utils.js"></script>
@ -38,7 +38,6 @@ nv.addGraph({
.attr('width', width)
.attr('height', height)
.datum(sinData())
.transition()
.call(chart);
return chart;

@ -1,106 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
<style>
body {
overflow-y:scroll;
}
text {
font: 12px sans-serif;
}
</style>
<body class='with-3d-shadow with-transitions'>
<div style="width: 100%; height: 400px;">
<svg id="test1"></svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/models/axis.js"></script>
<script src="../src/models/historicalBar.js"></script>
<script src="../src/models/historicalBarChart.js"></script>
<script src="../src/utils.js"></script>
<script>
var chart;
nv.addGraph(function() {
chart = nv.models.historicalBarChart();
chart
.margin({left: 100, bottom: 100})
.x(function(d,i) { return i })
.transitionDuration(250)
;
// chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately
chart.xAxis
.axisLabel("Time (s)")
.tickFormat(d3.format(',.1f'));
chart.yAxis
.axisLabel('Voltage (v)')
.tickFormat(d3.format(',.2f'));
chart.showXAxis(true);
d3.select('#test1')
.datum(sinData())
.transition().duration(0)
.call(chart);
//TODO: Figure out a good way to do this automatically
nv.utils.windowResize(chart.update);
//nv.utils.windowResize(function() { d3.select('#chart1 svg').call(chart) });
chart.dispatch.on('stateChange', function(e) { nv.log('New State:', JSON.stringify(e)); });
return chart;
});
//Simple test data generators
function sinAndCos() {
var sin = [],
cos = [];
for (var i = 0; i < 100; i++) {
sin.push({x: i, y: Math.sin(i/10)});
cos.push({x: i, y: .5 * Math.cos(i/10)});
}
return [
{
values: sin,
key: "Sine Wave",
color: "#ff7f0e"
},
{
values: cos,
key: "Cosine Wave",
color: "#2ca02c"
}
];
}
function sinData() {
var sin = [];
for (var i = 0; i < 100; i++) {
sin.push({x: i, y: Math.sin(i/10)});
}
return [
{
values: sin,
key: "Sine Wave",
color: "#ff7f0e"
}
];
}
</script>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

@ -13,9 +13,8 @@ body {
<div id="example1" style="width:600px"></div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/models/indentedTree.js"></script>
<script>

@ -1,98 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html>
<title>NVD3 Examples List</title>
<body>
<style>
body {
font-family: Helvetica;
/* IE10 Consumer Preview */
background-image: -ms-radial-gradient(left top, circle farthest-corner, #FFFFFF 0%, #DEE2FF 100%);
/* Mozilla Firefox */
background-image: -moz-radial-gradient(left top, circle farthest-corner, #FFFFFF 0%, #DEE2FF 100%);
/* Opera */
background-image: -o-radial-gradient(left top, circle farthest-corner, #FFFFFF 0%, #DEE2FF 100%);
/* Webkit (Safari/Chrome 10) */
background-image: -webkit-gradient(radial, left top, 0, left top, 1012, color-stop(0, #FFFFFF), color-stop(1, #DEE2FF));
/* Webkit (Chrome 11+) */
background-image: -webkit-radial-gradient(left top, circle farthest-corner, #FFFFFF 0%, #DEE2FF 100%);
/* W3C Markup, IE10 Release Preview */
background-image: radial-gradient(circle farthest-corner at left top, #FFFFFF 0%, #DEE2FF 100%);
}
ul {
list-style: none;
float: left;
margin-right: 20px;
border-right: solid 1px #ccc;
}
li {
padding: 8px;
min-width: 220px;
}
a {
text-decoration: none;
display:block;
}
li:hover {
background-color: #ccc;
}
</style>
<h2>NVD3 Examples List</h2>
<ul>
<li><a href="bullet.html">Bullet</a>
<li><a href="bulletChart.html">BulletChart</a>
<li><a href="crossfilter.html">Crossfilter</a>
<li><a href="crossfilterWithDimentions.html">CrossfilterWithDimentions</a>
<li><a href="crossfilterWithTables.html">CrossfilterWithTables</a>
<li><a href="cumulativeLineChart.html">CumulativeLineChart</a>
<li><a href="discreteBarChart.html">DiscreteBarChart</a>
<li><a href="historicalBar.html">HistoricalBar</a>
<li><a href="historicalBarChart.html">HistoricalBarChart</a>
<li><a href="horizon.html">Horizon</a>
<li><a href="indentedtree.html">Indentedtree</a>
<li><a href="legend.html">Legend</a>
<li><a href="line.html">Line</a>
<li><a href="lineChart.html">LineChart</a>
<li><a href="lineChartSVGResize.html">LineChartSVGResize</a>
<li><a href="linePlusBarChart.html">LinePlusBarChart</a>
<li><a href="linePlusBarWithFocusChart.html">LinePlusBarWithFocusChart</a>
<li><a href="lineWithFisheyeChart.html">LineWithFisheyeChart</a>
<li><a href="lineWithFocusChart.html">LineWithFocusChart</a>
</ul>
<ul>
<li><a href="multiBar.html">MultiBar</a>
<li><a href="multiBarChart.html">MultiBarChart</a>
<li><a href="multiBarHorizontalChart.html">MultiBarHorizontalChart</a>
<li><a href="multiChart.html">MultiChart</a>
<li><a href="parallelCoordinates.html">ParallelCoordinates</a>
<li><a href="pie.html">Pie</a>
<li><a href="pieChart.html">PieChart</a>
<li><a href="scatter.html">Scatter</a>
<li><a href="scatterChart.html">ScatterChart</a>
<li><a href="scatterPlusLineChart.html">ScatterPlusLineChart</a>
<li><a href="sparkline.html">Sparkline</a>
<li><a href="sparklinePlus.html">SparklinePlus</a>
<li><a href="stackedArea.html">StackedArea</a>
<li><a href="stackedAreaChart.html">StackedAreaChart</a>
</ul>
<ul>
<strong>Test pages</strong>
<li><a href="../test/lineChartTest.html">Line Chart</a></li>
<li><a href="../test/pieChartTest.html">Pie Chart</a></li>
<li><a href="../test/ScatterChartTest.html">Scatter Chart</a></li>
<li><a href="../test/stackedAreaChartTest.html">Stacked Area Chart</a></li>
<li><a href="../test/multiBarChartTest.html">Multibar Chart</a></li>
<li><a href="../test/polylinearTest.html">Polylinear Scale Line Chart</a></li>
<li><a href="../test/realTimeChartTest.html">Real Time Chart</a></li>
</ul>
</body>
</html>

@ -8,9 +8,8 @@
<svg id="test1"></svg>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/models/legend.js"></script>
<script>

@ -12,11 +12,10 @@ body {
<svg id="test1"></svg>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/line.js"></script>
<script src="../src/utils.js"></script>
<script>

@ -19,7 +19,7 @@ svg {
#chart1 svg {
height: 500px;
min-width: 200px;
min-width: 100px;
min-height: 100px;
/*
margin: 50px;
@ -27,58 +27,51 @@ svg {
For example width should be =< margin.left + margin.right + 1,
of course 1 pixel for the entire chart would not be very useful, BUT should not have errors
*/
}
#chart1 {
margin-top: 200px;
margin-left: 100px;
}
</style>
<body class='with-3d-shadow with-transitions'>
<body>
<div id="chart1" >
<svg style="height: 500px;"></svg>
</div>
<div id="chart1">
<svg style="height: 500px;"></svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/interactiveLayer.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/axis.js"></script>
<script src="../src/models/scatter.js"></script>
<script src="../src/models/line.js"></script>
<script src="../src/models/lineChart.js"></script>
<script>
// Wrapping in nv.addGraph allows for '0 timeout render', stores rendered charts in nv.graphs, and may do more in the future... it's NOT required
var chart;
nv.addGraph(function() {
chart = nv.models.lineChart()
.options({
margin: {left: 100, bottom: 100},
x: function(d,i) { return i},
showXAxis: true,
showYAxis: true,
transitionDuration: 250
})
;
// chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately
chart.xAxis
.axisLabel("Time (s)")
.tickFormat(d3.format(',.1f'));
chart = nv.models.lineChart();
chart
.x(function(d,i) { return i })
chart.xAxis // chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately
.tickFormat(d3.format(',.1f'));
chart.yAxis
.axisLabel('Voltage (v)')
.tickFormat(d3.format(',.2f'))
;
.axisLabel('Voltage (v)')
.tickFormat(d3.format(',.2f'));
d3.select('#chart1 svg')
.datum(sinAndCos())
.call(chart);
//.datum([]) //for testing noData
.datum(sinAndCos())
.transition().duration(500)
.call(chart);
//TODO: Figure out a good way to do this automatically
nv.utils.windowResize(chart.update);
@ -89,18 +82,15 @@ nv.addGraph(function() {
return chart;
});
function sinAndCos() {
var sin = [],
cos = [],
rand = [],
rand2 = []
;
cos = [];
for (var i = 0; i < 100; i++) {
sin.push({x: i, y: i % 10 == 5 ? null : Math.sin(i/10) }); //the nulls are to show how defined works
cos.push({x: i, y: .5 * Math.cos(i/10)});
rand.push({x:i, y: Math.random() / 10});
rand2.push({x: i, y: Math.cos(i/10) + Math.random() / 10 })
}
return [
@ -114,19 +104,9 @@ function sinAndCos() {
values: cos,
key: "Cosine Wave",
color: "#2ca02c"
},
{
values: rand,
key: "Random Points",
color: "#2222ff"
}
,
{
values: rand2,
key: "Random Cosine",
color: "#667711"
}
];
}
</script>

@ -23,11 +23,11 @@ svg {
<a href="#" id="zoomIn">Zoom In</a> <a href="#" id="zoomOut">Zoom Out</a>
</div>
<div id="chart1" class='with-transitions'>
<div id="chart1">
<svg></svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/utils.js"></script>
@ -46,7 +46,7 @@ nv.addGraph(function() {
var height = 300;
var zoom = 1;
chart.useInteractiveGuideline(true);
chart.xAxis
.tickFormat(d3.format(',r'));

@ -28,11 +28,11 @@ text {
</style>
<body>
<div id="chart1" class='with-3d-shadow with-transitions'>
<div id="chart1">
<svg> </svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/tooltip.js"></script>
@ -89,8 +89,7 @@ nv.addGraph(function() {
chart.xAxis.tickFormat(function(d) {
var dx = testdata[0].values[d] && testdata[0].values[d].x || 0;
return dx ? d3.time.format('%x')(new Date(dx)) : '';
})
.showMaxMin(false);
});
chart.y1Axis
.tickFormat(d3.format(',f'));
@ -98,7 +97,7 @@ nv.addGraph(function() {
chart.y2Axis
.tickFormat(function(d) { return '$' + d3.format(',.2f')(d) });
chart.bars.forceY([0]).padData(false);
chart.bars.forceY([0]);
//chart.lines.forceY([0]);
d3.select('#chart1 svg')

@ -28,11 +28,11 @@ text {
</style>
<body>
<div id="chart1" class='with-3d-shadow with-transitions'>
<div id="chart1">
<svg> </svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/tooltip.js"></script>
@ -119,7 +119,7 @@ nv.addGraph(function() {
nv.log(testdata);
d3.select('#chart1 svg')
.datum(testdata)
.call(chart);
.transition().duration(500).call(chart);
// nv.utils.windowResize(chart.update);

@ -32,11 +32,11 @@ svg {
</style>
<body>
<div id="chart1" class='with-3d-shadow with-transitions'>
<div id="chart1">
<svg style="height: 500px;"></svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../lib/fisheye.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>

@ -32,11 +32,11 @@ svg {
</style>
<body>
<div id="chart" class='with-3d-shadow with-transitions'>
<div id="chart">
<svg style="height: 500px;"></svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/utils.js"></script>
@ -52,7 +52,6 @@ svg {
nv.addGraph(function() {
var chart = nv.models.lineWithFocusChart();
// chart.transitionDuration(500);
chart.xAxis
.tickFormat(d3.format(',f'));
chart.x2Axis
@ -65,6 +64,7 @@ nv.addGraph(function() {
d3.select('#chart svg')
.datum(testData())
.transition().duration(500)
.call(chart);
nv.utils.windowResize(chart.update);

@ -21,13 +21,12 @@ text {
<svg></svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/axis.js"></script>
<script src="../src/models/multiBar.js"></script>
<script src="../src/utils.js"></script>
<script src="stream_layers.js"></script>
<script>
@ -82,7 +81,6 @@ nv.addGraph({
d3.select('#test1 svg')
.attr('width', width)
.attr('height', height)
transition().duration(500)
.call(graph);
};

@ -28,11 +28,11 @@ text {
</style>
<body>
<div id="chart1" class='with-3d-shadow with-transitions'>
<div id="chart1">
<svg></svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/utils.js"></script>
@ -55,7 +55,7 @@ console.log('td',test_data);
var negative_test_data = new d3.range(0,3).map(function(d,i) { return {
key: 'Stream' + i,
values: new d3.range(0,11).map( function(f,j) {
values: new d3.range(0,10).map( function(f,j) {
return {
y: 10 + Math.random()*100 * (Math.floor(Math.random()*100)%2 ? 1 : -1),
x: j
@ -67,30 +67,21 @@ var negative_test_data = new d3.range(0,3).map(function(d,i) { return {
var chart;
nv.addGraph(function() {
chart = nv.models.multiBarChart()
.barColor(d3.scale.category20().range())
.margin({bottom: 100})
.transitionDuration(300)
.delay(0)
.rotateLabels(45)
.groupSpacing(0.1)
;
.barColor(d3.scale.category20().range());
chart.multibar
.hideable(true);
chart.reduceXTicks(false).staggerLabels(true);
chart.xAxis
.axisLabel("Current Index")
.showMaxMin(true)
.tickFormat(d3.format(',.6f'));
.tickFormat(d3.format(',f'));
chart.yAxis
.tickFormat(d3.format(',.1f'));
d3.select('#chart1 svg')
.datum(negative_test_data)
.call(chart);
.transition().duration(500).call(chart);
nv.utils.windowResize(chart.update);

@ -31,11 +31,11 @@ text {
</style>
<body>
<div id="chart1" class='with-3d-shadow with-transitions'>
<div id="chart1">
<svg></svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/tooltip.js"></script>
@ -366,15 +366,14 @@ nv.addGraph(function() {
//.showValues(true)
//.tooltips(false)
.barColor(d3.scale.category20().range())
.transitionDuration(250)
.stacked(true)
//.showControls(false);
.showControls(true);
chart.yAxis
.tickFormat(d3.format(',.2f'));
d3.select('#chart1 svg')
.datum(long_short_data)
.transition().duration(500)
.call(chart);
nv.utils.windowResize(chart.update);

@ -1,5 +1,4 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
@ -27,15 +26,14 @@ text {
}
</style>
<body class='with-3d-shadow with-transitions'>
<body>
<div id="chart1" >
<div id="chart1">
<svg> </svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/axis.js"></script>
@ -93,4 +91,3 @@ nv.addGraph(function() {
});
</script>
</html>

@ -1,8 +1,11 @@
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script type="text/javascript" src="../src/utils.js"></script>
<style>
body {
@ -29,9 +32,7 @@ svg {
<svg></svg>
</div>
<script type="text/javascript" src="../lib/d3.v3.js"></script>
<script type="text/javascript" src="../nv.d3.js"></script>
<script type="text/javascript" src="../src/utils.js"></script>
<script type="text/javascript" src="../src/models/parallelCoordinates.js"></script>
<script>
@ -45,9 +46,9 @@ svg {
.datum(data)
.call(chart);
// chart.dispatch.on('brush', function(e) {
// nv.log(e);
// });
chart.dispatch.on('brush', function(e) {
nv.log(e);
});
nv.utils.windowResize(chart.update);

@ -18,9 +18,8 @@ text {
<svg id="test2"></svg>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/models/pie.js"></script>
<script>

@ -16,7 +16,7 @@ text {
border: 2px;
}
</style>
<body class='with-3d-shadow with-transitions'>
<body>
<h2>Test1</h2>
<svg id="test1" class="mypiechart"></svg>
@ -24,7 +24,7 @@ text {
<h2>Test2</h2>
<svg id="test2" class="mypiechart"></svg>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/pie.js"></script>
@ -71,12 +71,14 @@ nv.addGraph(function() {
var chart = nv.models.pieChart()
.x(function(d) { return d.key })
.y(function(d) { return d.y })
//.showLabels(false)
.values(function(d) { return d })
.color(d3.scale.category10().range())
.width(width)
.height(height);
d3.select("#test1")
.datum(testdata)
.datum([testdata])
.transition().duration(1200)
.attr('width', width)
.attr('height', height)
@ -95,6 +97,7 @@ nv.addGraph(function() {
var chart = nv.models.pieChart()
.x(function(d) { return d.key })
//.y(function(d) { return d.value })
.values(function(d) { return d })
//.labelThreshold(.08)
//.showLabels(false)
.color(d3.scale.category10().range())
@ -110,7 +113,7 @@ nv.addGraph(function() {
d3.select("#test2")
//.datum(historicalBarChart)
.datum(testdata)
.datum([testdata])
.transition().duration(1200)
.attr('width', width)
.attr('height', height)

@ -12,10 +12,9 @@ body {
<svg id="test1"></svg>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../lib/fisheye.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/scatter.js"></script>
<script>

@ -41,12 +41,12 @@ div {
<body>
<div id="offsetDiv">
<div id="test1" class='with-3d-shadow with-transitions'>
<div id="test1" class="chartWrap">
<svg></svg>
</div>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<!--<script src="../lib/fisheye.js"></script>-->
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>
@ -66,24 +66,21 @@ nv.addGraph(function() {
chart = nv.models.scatterChart()
.showDistX(true)
.showDistY(true)
//.height(500)
.useVoronoi(true)
.color(d3.scale.category10().range())
.transitionDuration(300)
;
.color(d3.scale.category10().range());
chart.xAxis.tickFormat(d3.format('.02f'));
chart.yAxis.tickFormat(d3.format('.02f'));
chart.tooltipContent(function(key) {
return '<h2>' + key + '</h2>';
});
chart.xAxis.tickFormat(d3.format('.02f'))
chart.yAxis.tickFormat(d3.format('.02f'))
d3.select('#test1 svg')
.datum(randomData(4,40))
.transition().duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
chart.dispatch.on('stateChange', function(e) { ('New State:', JSON.stringify(e)); });
chart.dispatch.on('stateChange', function(e) { nv.log('New State:', JSON.stringify(e)); });
return chart;
});

@ -38,7 +38,7 @@ div {
</style>
<body class='with-3d-shadow with-transitions'>
<body>
<div id="offsetDiv">
<div id="test1" class="chartWrap">
@ -46,7 +46,7 @@ div {
</div>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../lib/fisheye.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>
@ -66,14 +66,15 @@ nv.addGraph(function() {
chart = nv.models.scatterPlusLineChart()
.showDistX(true)
.showDistY(true)
.transitionDuration(300)
//.height(500)
.color(d3.scale.category10().range());
chart.xAxis.tickFormat(d3.format('.02f'))
chart.yAxis.tickFormat(d3.format('.02f'))
d3.select('#test1 svg')
.datum(nv.log(randomData(4,40)))
.datum(randomData(4,40))
.transition().duration(500)
.call(chart);
nv.utils.windowResize(chart.update);

@ -22,7 +22,7 @@ text {
<h2>Sparkline: <svg id="chart1" class="sparkline"></svg></h2>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/models/sparkline.js"></script>
<script src="../src/utils.js"></script>

@ -3,61 +3,58 @@
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
<style>
svg.sparkline {
#chart1 {
width: 500px;
height: 70px;
height: 50px;
font-size: 14px;
margin-top: -6px;
}
h2, p {
float: left;
}
</style>
<body class='with-3d-shadow with-transitions'>
<body>
<h2>SparklinePlus:</h2>
<p><svg id="chart1" class="sparkline"></svg></p>
<br/>
<p>APPL:<svg id="chart2" class="sparkline"></svg></p>
<p>GOOG:<svg id="chart3" class="sparkline"></svg></p>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/models/sparkline.js"></script>
<script src="../src/models/sparklinePlus.js"></script>
<script>
function defaultChartConfig(containerId, data) {
nv.addGraph(function() {
nv.addGraph(function() {
var data = sine();
var chart = nv.models.sparklinePlus()
var chart = nv.models.sparklinePlus()
chart
.margin({left:70})
.x(function(d,i) { return i })
.xTickFormat(function(d) {
return d3.time.format('%x')(new Date(data[d].x))
})
chart
.margin({left:70})
.x(function(d,i) { return i })
.xTickFormat(function(d) {
return d3.time.format('%x')(new Date(data[d].x))
})
d3.select("#chart1")
.datum(data)
.transition().duration(250)
.call(chart);
d3.select(containerId)
.datum(data)
.transition().duration(250)
.call(chart);
return chart;
});
return chart;
});
}
defaultChartConfig("#chart1",sine());
defaultChartConfig("#chart2", volatileChart(130.0, 0.02));
defaultChartConfig("#chart3", volatileChart(25.0, 0.09,30));
var now =+new Date();
function sine() {
var sin = [];
var now =+new Date();
nv.log(now);
for (var i = 0; i < 100; i++) {
sin.push({x: now + i * 1000 * 60 * 60 * 24, y: Math.sin(i/10)});
@ -66,21 +63,5 @@ function sine() {
return sin;
}
function volatileChart(startPrice, volatility, numPoints) {
var rval = [];
var now =+new Date();
numPoints = numPoints || 100;
for(var i = 1; i < numPoints; i++) {
rval.push({x: now + i * 1000 * 60 * 60 * 24, y: startPrice});
var rnd = Math.random();
var changePct = 2 * volatility * rnd;
if ( changePct > volatility) {
changePct -= (2*volatility);
}
startPrice = startPrice + startPrice * changePct;
}
return rval;
}
</script>

@ -20,9 +20,8 @@ text {
<svg></svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/models/stackedArea.js"></script>
<script>

@ -18,7 +18,7 @@ text {
}
</style>
<body class='with-3d-shadow with-transitions'>
<body>
<div>
<svg id="chart1"></svg>
@ -28,12 +28,11 @@ text {
<!--<svg id="chart2"></svg>-->
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/models/axis.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/interactiveLayer.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/axis.js"></script>
<script src="../src/models/scatter.js"></script>
@ -42,47 +41,47 @@ text {
<script>
var histcatexplong = [
{
"key" : "Consumer Discretionary" ,
var histcatexplong = [
{
"key" : "Consumer Discretionary" ,
"values" : [ [ 1138683600000 , 27.38478809681] , [ 1141102800000 , 27.371377218208] , [ 1143781200000 , 26.309915460827] , [ 1146369600000 , 26.425199957521] , [ 1149048000000 , 26.823411519395] , [ 1151640000000 , 23.850443591584] , [ 1154318400000 , 23.158355444054] , [ 1156996800000 , 22.998689393694] , [ 1159588800000 , 27.977128511299] , [ 1162270800000 , 29.073672469721] , [ 1164862800000 , 28.587640408904] , [ 1167541200000 , 22.788453687638] , [ 1170219600000 , 22.429199073597] , [ 1172638800000 , 22.324103271051] , [ 1175313600000 , 17.558388444186] , [ 1177905600000 , 16.769518096208] , [ 1180584000000 , 16.214738201302] , [ 1183176000000 , 18.729632971228] , [ 1185854400000 , 18.814523318848] , [ 1188532800000 , 19.789986451358] , [ 1191124800000 , 17.070049054933] , [ 1193803200000 , 16.121349575715] , [ 1196398800000 , 15.141659430091] , [ 1199077200000 , 17.175388025298] , [ 1201755600000 , 17.286592443521] , [ 1204261200000 , 16.323141626569] , [ 1206936000000 , 19.231263773952] , [ 1209528000000 , 18.446256391094] , [ 1212206400000 , 17.822632399764] , [ 1214798400000 , 15.539366475979] , [ 1217476800000 , 15.255131790216] , [ 1220155200000 , 15.660963922593] , [ 1222747200000 , 13.254482273697] , [ 1225425600000 , 11.920796202299] , [ 1228021200000 , 12.122809090925] , [ 1230699600000 , 15.691026271393] , [ 1233378000000 , 14.720881635107] , [ 1235797200000 , 15.387939360044] , [ 1238472000000 , 13.765436672229] , [ 1241064000000 , 14.6314458648] , [ 1243742400000 , 14.292446536221] , [ 1246334400000 , 16.170071367016] , [ 1249012800000 , 15.948135554337] , [ 1251691200000 , 16.612872685134] , [ 1254283200000 , 18.778338719091] , [ 1256961600000 , 16.75602606542] , [ 1259557200000 , 19.385804443147] , [ 1262235600000 , 22.950590240168] , [ 1264914000000 , 23.61159018141] , [ 1267333200000 , 25.708586989581] , [ 1270008000000 , 26.883915999885] , [ 1272600000000 , 25.893486687065] , [ 1275278400000 , 24.678914263176] , [ 1277870400000 , 25.937275793023] , [ 1280548800000 , 29.46138169384] , [ 1283227200000 , 27.357322961862] , [ 1285819200000 , 29.057235285673] , [ 1288497600000 , 28.549434189386] , [ 1291093200000 , 28.506352379723] , [ 1293771600000 , 29.449241421597] , [ 1296450000000 , 25.796838168807] , [ 1298869200000 , 28.740145449189] , [ 1301544000000 , 22.091744141872] , [ 1304136000000 , 25.079662545409] , [ 1306814400000 , 23.674906973064] , [ 1309406400000 , 23.41800274293] , [ 1312084800000 , 23.243644138871] , [ 1314763200000 , 31.591854066817] , [ 1317355200000 , 31.497112374114] , [ 1320033600000 , 26.672380820431] , [ 1322629200000 , 27.297080015495] , [ 1325307600000 , 20.174315530051] , [ 1327986000000 , 19.631084213899] , [ 1330491600000 , 20.366462219462] , [ 1333166400000 , 17.429019937289] , [ 1335758400000 , 16.75543633539] , [ 1338436800000 , 16.182906906042]]
} ,
{
"key" : "Consumer Staples" ,
} ,
{
"key" : "Consumer Staples" ,
"values" : [ [ 1138683600000 , 7.2800122043237] , [ 1141102800000 , 7.1187787503354] , [ 1143781200000 , 8.351887016482] , [ 1146369600000 , 8.4156698763993] , [ 1149048000000 , 8.1673298604231] , [ 1151640000000 , 5.5132447126042] , [ 1154318400000 , 6.1152537710599] , [ 1156996800000 , 6.076765091942] , [ 1159588800000 , 4.6304473798646] , [ 1162270800000 , 4.6301068469402] , [ 1164862800000 , 4.3466656309389] , [ 1167541200000 , 6.830104897003] , [ 1170219600000 , 7.241633040029] , [ 1172638800000 , 7.1432372054153] , [ 1175313600000 , 10.608942063374] , [ 1177905600000 , 10.914964549494] , [ 1180584000000 , 10.933223880565] , [ 1183176000000 , 8.3457524851265] , [ 1185854400000 , 8.1078413081882] , [ 1188532800000 , 8.2697185922474] , [ 1191124800000 , 8.4742436475968] , [ 1193803200000 , 8.4994601179319] , [ 1196398800000 , 8.7387319683243] , [ 1199077200000 , 6.8829183612895] , [ 1201755600000 , 6.984133637885] , [ 1204261200000 , 7.0860136043287] , [ 1206936000000 , 4.3961787956053] , [ 1209528000000 , 3.8699674365231] , [ 1212206400000 , 3.6928925238305] , [ 1214798400000 , 6.7571718894253] , [ 1217476800000 , 6.4367313362344] , [ 1220155200000 , 6.4048441521454] , [ 1222747200000 , 5.4643833239669] , [ 1225425600000 , 5.3150786833374] , [ 1228021200000 , 5.3011272612576] , [ 1230699600000 , 4.1203601430809] , [ 1233378000000 , 4.0881783200525] , [ 1235797200000 , 4.1928665957189] , [ 1238472000000 , 7.0249415663205] , [ 1241064000000 , 7.006530880769] , [ 1243742400000 , 6.994835633224] , [ 1246334400000 , 6.1220222336254] , [ 1249012800000 , 6.1177436137653] , [ 1251691200000 , 6.1413396231981] , [ 1254283200000 , 4.8046006145874] , [ 1256961600000 , 4.6647600660544] , [ 1259557200000 , 4.544865006255] , [ 1262235600000 , 6.0488249316539] , [ 1264914000000 , 6.3188669540206] , [ 1267333200000 , 6.5873958262306] , [ 1270008000000 , 6.2281189839578] , [ 1272600000000 , 5.8948915746059] , [ 1275278400000 , 5.5967320482214] , [ 1277870400000 , 0.99784432084837] , [ 1280548800000 , 1.0950794175359] , [ 1283227200000 , 0.94479734407491] , [ 1285819200000 , 1.222093988688] , [ 1288497600000 , 1.335093106856] , [ 1291093200000 , 1.3302565104985] , [ 1293771600000 , 1.340824670897] , [ 1296450000000 , 0] , [ 1298869200000 , 0] , [ 1301544000000 , 0] , [ 1304136000000 , 0] , [ 1306814400000 , 0] , [ 1309406400000 , 0] , [ 1312084800000 , 0] , [ 1314763200000 , 0] , [ 1317355200000 , 4.4583692315] , [ 1320033600000 , 3.6493043348059] , [ 1322629200000 , 3.8610064091761] , [ 1325307600000 , 5.5144800685202] , [ 1327986000000 , 5.1750695220792] , [ 1330491600000 , 5.6710066952691] , [ 1333166400000 , 8.5658461590953] , [ 1335758400000 , 8.6135447714243] , [ 1338436800000 , 8.0231460925212]]
} ,
{
"key" : "Energy" ,
} ,
{
"key" : "Energy" ,
"values" : [ [ 1138683600000 , 1.544303464167] , [ 1141102800000 , 1.4387289432421] , [ 1143781200000 , 0] , [ 1146369600000 , 0] , [ 1149048000000 , 0] , [ 1151640000000 , 1.328626801128] , [ 1154318400000 , 1.2874050802627] , [ 1156996800000 , 1.0872743105593] , [ 1159588800000 , 0.96042562635813] , [ 1162270800000 , 0.93139372870616] , [ 1164862800000 , 0.94432167305385] , [ 1167541200000 , 1.277750166208] , [ 1170219600000 , 1.2204893886811] , [ 1172638800000 , 1.207489123122] , [ 1175313600000 , 1.2490651414113] , [ 1177905600000 , 1.2593129913052] , [ 1180584000000 , 1.373329808388] , [ 1183176000000 , 0] , [ 1185854400000 , 0] , [ 1188532800000 , 0] , [ 1191124800000 , 0] , [ 1193803200000 , 0] , [ 1196398800000 , 0] , [ 1199077200000 , 0] , [ 1201755600000 , 0] , [ 1204261200000 , 0] , [ 1206936000000 , 0] , [ 1209528000000 , 0] , [ 1212206400000 , 0] , [ 1214798400000 , 0] , [ 1217476800000 , 0] , [ 1220155200000 , 0] , [ 1222747200000 , 1.4516108933695] , [ 1225425600000 , 1.1856025268225] , [ 1228021200000 , 1.3430470355439] , [ 1230699600000 , 2.2752595354509] , [ 1233378000000 , 2.4031560010523] , [ 1235797200000 , 2.0822430731926] , [ 1238472000000 , 1.5640902826938] , [ 1241064000000 , 1.5812873972356] , [ 1243742400000 , 1.9462448548894] , [ 1246334400000 , 2.9464870223957] , [ 1249012800000 , 3.0744699383222] , [ 1251691200000 , 2.9422304628446] , [ 1254283200000 , 2.7503075599999] , [ 1256961600000 , 2.6506701800427] , [ 1259557200000 , 2.8005425319977] , [ 1262235600000 , 2.6816184971185] , [ 1264914000000 , 2.681206271327] , [ 1267333200000 , 2.8195488011259] , [ 1270008000000 , 0] , [ 1272600000000 , 0] , [ 1275278400000 , 0] , [ 1277870400000 , 1.0687057346382] , [ 1280548800000 , 1.2539400544134] , [ 1283227200000 , 1.1862969445955] , [ 1285819200000 , 0] , [ 1288497600000 , 0] , [ 1291093200000 , 0] , [ 1293771600000 , 0] , [ 1296450000000 , 1.941972859484] , [ 1298869200000 , 2.1142247697552] , [ 1301544000000 , 2.3788590206824] , [ 1304136000000 , 2.5337302877545] , [ 1306814400000 , 2.3163370395199] , [ 1309406400000 , 2.0645451843195] , [ 1312084800000 , 2.1004446672411] , [ 1314763200000 , 3.6301875804303] , [ 1317355200000 , 2.454204664652] , [ 1320033600000 , 2.196082370894] , [ 1322629200000 , 2.3358418255202] , [ 1325307600000 , 0] , [ 1327986000000 , 0] , [ 1330491600000 , 0] , [ 1333166400000 , 0.39001201038526] , [ 1335758400000 , 0.30945472725559] , [ 1338436800000 , 0.31062439305591]]
} ,
{
"key" : "Financials" ,
} ,
{
"key" : "Financials" ,
"values" : [ [ 1138683600000 , 13.356778764352] , [ 1141102800000 , 13.611196863271] , [ 1143781200000 , 6.895903006119] , [ 1146369600000 , 6.9939633271352] , [ 1149048000000 , 6.7241510257675] , [ 1151640000000 , 5.5611293669516] , [ 1154318400000 , 5.6086488714041] , [ 1156996800000 , 5.4962849907033] , [ 1159588800000 , 6.9193153169279] , [ 1162270800000 , 7.0016334389777] , [ 1164862800000 , 6.7865422443273] , [ 1167541200000 , 9.0006454225383] , [ 1170219600000 , 9.2233916171431] , [ 1172638800000 , 8.8929316009479] , [ 1175313600000 , 10.345937520404] , [ 1177905600000 , 10.075914677026] , [ 1180584000000 , 10.089006188111] , [ 1183176000000 , 10.598330295008] , [ 1185854400000 , 9.968954653301] , [ 1188532800000 , 9.7740580198146] , [ 1191124800000 , 10.558483060626] , [ 1193803200000 , 9.9314651823603] , [ 1196398800000 , 9.3997715873769] , [ 1199077200000 , 8.4086493387262] , [ 1201755600000 , 8.9698309085926] , [ 1204261200000 , 8.2778357995396] , [ 1206936000000 , 8.8585045600123] , [ 1209528000000 , 8.7013756413322] , [ 1212206400000 , 7.7933605469443] , [ 1214798400000 , 7.0236183483064] , [ 1217476800000 , 6.9873088186829] , [ 1220155200000 , 6.8031713070097] , [ 1222747200000 , 6.6869531315723] , [ 1225425600000 , 6.138256993963] , [ 1228021200000 , 5.6434994016354] , [ 1230699600000 , 5.495220262512] , [ 1233378000000 , 4.6885326869846] , [ 1235797200000 , 4.4524349883438] , [ 1238472000000 , 5.6766520778185] , [ 1241064000000 , 5.7675774480752] , [ 1243742400000 , 5.7882863168337] , [ 1246334400000 , 7.2666010034924] , [ 1249012800000 , 7.519182132226] , [ 1251691200000 , 7.849651451445] , [ 1254283200000 , 10.383992037985] , [ 1256961600000 , 9.0653691861818] , [ 1259557200000 , 9.6705248324159] , [ 1262235600000 , 10.856380561349] , [ 1264914000000 , 11.27452370892] , [ 1267333200000 , 11.754156529088] , [ 1270008000000 , 8.2870811422456] , [ 1272600000000 , 8.0210264360699] , [ 1275278400000 , 7.5375074474865] , [ 1277870400000 , 8.3419527338039] , [ 1280548800000 , 9.4197471818443] , [ 1283227200000 , 8.7321733185797] , [ 1285819200000 , 9.6627062648126] , [ 1288497600000 , 10.187962234549] , [ 1291093200000 , 9.8144201733476] , [ 1293771600000 , 10.275723361713] , [ 1296450000000 , 16.796066079353] , [ 1298869200000 , 17.543254984075] , [ 1301544000000 , 16.673660675084] , [ 1304136000000 , 17.963944353609] , [ 1306814400000 , 16.637740867211] , [ 1309406400000 , 15.84857094609] , [ 1312084800000 , 14.767303362182] , [ 1314763200000 , 24.778452182432] , [ 1317355200000 , 18.370353229999] , [ 1320033600000 , 15.2531374291] , [ 1322629200000 , 14.989600840649] , [ 1325307600000 , 16.052539160125] , [ 1327986000000 , 16.424390322793] , [ 1330491600000 , 17.884020741105] , [ 1333166400000 , 7.1424929577921] , [ 1335758400000 , 7.8076213051482] , [ 1338436800000 , 7.2462684949232]]
} ,
{
"key" : "Health Care" ,
} ,
{
"key" : "Health Care" ,
"values" : [ [ 1138683600000 , 14.212410956029] , [ 1141102800000 , 13.973193618249] , [ 1143781200000 , 15.218233920665] , [ 1146369600000 , 14.38210972745] , [ 1149048000000 , 13.894310878491] , [ 1151640000000 , 15.593086090032] , [ 1154318400000 , 16.244839695188] , [ 1156996800000 , 16.017088850646] , [ 1159588800000 , 14.183951830055] , [ 1162270800000 , 14.148523245697] , [ 1164862800000 , 13.424326059972] , [ 1167541200000 , 12.974450435753] , [ 1170219600000 , 13.23247041802] , [ 1172638800000 , 13.318762655574] , [ 1175313600000 , 15.961407746104] , [ 1177905600000 , 16.287714639805] , [ 1180584000000 , 16.246590583889] , [ 1183176000000 , 17.564505594809] , [ 1185854400000 , 17.872725373165] , [ 1188532800000 , 18.018998508757] , [ 1191124800000 , 15.584518016603] , [ 1193803200000 , 15.480850647181] , [ 1196398800000 , 15.699120036984] , [ 1199077200000 , 19.184281817226] , [ 1201755600000 , 19.691226605207] , [ 1204261200000 , 18.982314051295] , [ 1206936000000 , 18.707820309008] , [ 1209528000000 , 17.459630929761] , [ 1212206400000 , 16.500616076782] , [ 1214798400000 , 18.086324003979] , [ 1217476800000 , 18.929464156258] , [ 1220155200000 , 18.233728682084] , [ 1222747200000 , 16.315776297325] , [ 1225425600000 , 14.63289219025] , [ 1228021200000 , 14.667835024478] , [ 1230699600000 , 13.946993947308] , [ 1233378000000 , 14.394304684397] , [ 1235797200000 , 13.724462792967] , [ 1238472000000 , 10.930879035806] , [ 1241064000000 , 9.8339915513708] , [ 1243742400000 , 10.053858541872] , [ 1246334400000 , 11.786998438287] , [ 1249012800000 , 11.780994901769] , [ 1251691200000 , 11.305889670276] , [ 1254283200000 , 10.918452290083] , [ 1256961600000 , 9.6811395055706] , [ 1259557200000 , 10.971529744038] , [ 1262235600000 , 13.330210480209] , [ 1264914000000 , 14.592637568961] , [ 1267333200000 , 14.605329141157] , [ 1270008000000 , 13.936853794037] , [ 1272600000000 , 12.189480759072] , [ 1275278400000 , 11.676151385046] , [ 1277870400000 , 13.058852800017] , [ 1280548800000 , 13.62891543203] , [ 1283227200000 , 13.811107569918] , [ 1285819200000 , 13.786494560787] , [ 1288497600000 , 14.04516285753] , [ 1291093200000 , 13.697412447288] , [ 1293771600000 , 13.677681376221] , [ 1296450000000 , 19.961511864531] , [ 1298869200000 , 21.049198298158] , [ 1301544000000 , 22.687631094008] , [ 1304136000000 , 25.469010617433] , [ 1306814400000 , 24.883799437121] , [ 1309406400000 , 24.203843814248] , [ 1312084800000 , 22.138760964038] , [ 1314763200000 , 16.034636966228] , [ 1317355200000 , 15.394958944556] , [ 1320033600000 , 12.625642461969] , [ 1322629200000 , 12.973735699739] , [ 1325307600000 , 15.786018336149] , [ 1327986000000 , 15.227368020134] , [ 1330491600000 , 15.899752650734] , [ 1333166400000 , 18.994731295388] , [ 1335758400000 , 18.450055817702] , [ 1338436800000 , 17.863719889669]]
} ,
{
"key" : "Industrials" ,
} ,
{
"key" : "Industrials" ,
"values" : [ [ 1138683600000 , 7.1590087090398] , [ 1141102800000 , 7.1297210970108] , [ 1143781200000 , 5.5774588290586] , [ 1146369600000 , 5.4977254491156] , [ 1149048000000 , 5.5138153113634] , [ 1151640000000 , 4.3198084032122] , [ 1154318400000 , 3.9179295839125] , [ 1156996800000 , 3.8110093051479] , [ 1159588800000 , 5.5629020916939] , [ 1162270800000 , 5.7241673711336] , [ 1164862800000 , 5.4715049695004] , [ 1167541200000 , 4.9193763571618] , [ 1170219600000 , 5.136053947247] , [ 1172638800000 , 5.1327258759766] , [ 1175313600000 , 5.1888943925082] , [ 1177905600000 , 5.5191481293345] , [ 1180584000000 , 5.6093625614921] , [ 1183176000000 , 4.2706312987397] , [ 1185854400000 , 4.4453235132117] , [ 1188532800000 , 4.6228003109761] , [ 1191124800000 , 5.0645764756954] , [ 1193803200000 , 5.0723447230959] , [ 1196398800000 , 5.1457765818846] , [ 1199077200000 , 5.4067851597282] , [ 1201755600000 , 5.472241916816] , [ 1204261200000 , 5.3742740389688] , [ 1206936000000 , 6.251751933664] , [ 1209528000000 , 6.1406852153472] , [ 1212206400000 , 5.8164385627465] , [ 1214798400000 , 5.4255846656171] , [ 1217476800000 , 5.3738499417204] , [ 1220155200000 , 5.1815627753979] , [ 1222747200000 , 5.0305983235349] , [ 1225425600000 , 4.6823058607165] , [ 1228021200000 , 4.5941481589093] , [ 1230699600000 , 5.4669598474575] , [ 1233378000000 , 5.1249037357] , [ 1235797200000 , 4.3504421250742] , [ 1238472000000 , 4.6260881026002] , [ 1241064000000 , 5.0140402458946] , [ 1243742400000 , 4.7458462454774] , [ 1246334400000 , 6.0437019654564] , [ 1249012800000 , 6.4595216249754] , [ 1251691200000 , 6.6420468254155] , [ 1254283200000 , 5.8927271960913] , [ 1256961600000 , 5.4712108838003] , [ 1259557200000 , 6.1220254207747] , [ 1262235600000 , 5.5385935169255] , [ 1264914000000 , 5.7383377612639] , [ 1267333200000 , 6.1715976730415] , [ 1270008000000 , 4.0102262681174] , [ 1272600000000 , 3.769389679692] , [ 1275278400000 , 3.5301571031152] , [ 1277870400000 , 2.7660252652526] , [ 1280548800000 , 3.1409983385775] , [ 1283227200000 , 3.0528024863055] , [ 1285819200000 , 4.3126123157971] , [ 1288497600000 , 4.594654041683] , [ 1291093200000 , 4.5424126126793] , [ 1293771600000 , 4.7790043987302] , [ 1296450000000 , 7.4969154058289] , [ 1298869200000 , 7.9424751557821] , [ 1301544000000 , 7.1560736250547] , [ 1304136000000 , 7.9478117337855] , [ 1306814400000 , 7.4109214848895] , [ 1309406400000 , 7.5966457641101] , [ 1312084800000 , 7.165754444071] , [ 1314763200000 , 5.4816702524302] , [ 1317355200000 , 4.9893656089584] , [ 1320033600000 , 4.498385105327] , [ 1322629200000 , 4.6776090358151] , [ 1325307600000 , 8.1350814368063] , [ 1327986000000 , 8.0732769990652] , [ 1330491600000 , 8.5602340387277] , [ 1333166400000 , 5.1293714074325] , [ 1335758400000 , 5.2586794619016] , [ 1338436800000 , 5.1100853569977]]
} ,
{
"key" : "Information Technology" ,
} ,
{
"key" : "Information Technology" ,
"values" : [ [ 1138683600000 , 13.242301508051] , [ 1141102800000 , 12.863536342042] , [ 1143781200000 , 21.034044171629] , [ 1146369600000 , 21.419084618803] , [ 1149048000000 , 21.142678863691] , [ 1151640000000 , 26.568489677529] , [ 1154318400000 , 24.839144939905] , [ 1156996800000 , 25.456187462167] , [ 1159588800000 , 26.350164502826] , [ 1162270800000 , 26.47833320519] , [ 1164862800000 , 26.425979547847] , [ 1167541200000 , 28.191461582256] , [ 1170219600000 , 28.930307448808] , [ 1172638800000 , 29.521413891117] , [ 1175313600000 , 28.188285966466] , [ 1177905600000 , 27.704619625832] , [ 1180584000000 , 27.490862424829] , [ 1183176000000 , 28.770679721286] , [ 1185854400000 , 29.060480671449] , [ 1188532800000 , 28.240998844973] , [ 1191124800000 , 33.004893194127] , [ 1193803200000 , 34.075180359928] , [ 1196398800000 , 32.548560664833] , [ 1199077200000 , 30.629727432728] , [ 1201755600000 , 28.642858788159] , [ 1204261200000 , 27.973575227842] , [ 1206936000000 , 27.393351882726] , [ 1209528000000 , 28.476095288523] , [ 1212206400000 , 29.29667866426] , [ 1214798400000 , 29.222333802896] , [ 1217476800000 , 28.092966093843] , [ 1220155200000 , 28.107159262922] , [ 1222747200000 , 25.482974832098] , [ 1225425600000 , 21.208115993834] , [ 1228021200000 , 20.295043095268] , [ 1230699600000 , 15.925754618401] , [ 1233378000000 , 17.162864628346] , [ 1235797200000 , 17.084345773174] , [ 1238472000000 , 22.246007102281] , [ 1241064000000 , 24.530543998509] , [ 1243742400000 , 25.084184918242] , [ 1246334400000 , 16.606166527358] , [ 1249012800000 , 17.239620011628] , [ 1251691200000 , 17.336739127379] , [ 1254283200000 , 25.478492475753] , [ 1256961600000 , 23.017152085245] , [ 1259557200000 , 25.617745423683] , [ 1262235600000 , 24.061133998642] , [ 1264914000000 , 23.223933318644] , [ 1267333200000 , 24.425887263937] , [ 1270008000000 , 35.501471156693] , [ 1272600000000 , 33.775013878676] , [ 1275278400000 , 30.417993630285] , [ 1277870400000 , 30.023598978467] , [ 1280548800000 , 33.327519522436] , [ 1283227200000 , 31.963388450371] , [ 1285819200000 , 30.498967232092] , [ 1288497600000 , 32.403696817912] , [ 1291093200000 , 31.47736071922] , [ 1293771600000 , 31.53259666241] , [ 1296450000000 , 41.760282761548] , [ 1298869200000 , 45.605771243237] , [ 1301544000000 , 39.986557966215] , [ 1304136000000 , 43.846330510051] , [ 1306814400000 , 39.857316881857] , [ 1309406400000 , 37.675127768208] , [ 1312084800000 , 35.775077970313] , [ 1314763200000 , 48.631009702577] , [ 1317355200000 , 42.830831754505] , [ 1320033600000 , 35.611502589362] , [ 1322629200000 , 35.320136981738] , [ 1325307600000 , 31.564136901516] , [ 1327986000000 , 32.074407502433] , [ 1330491600000 , 35.053013769976] , [ 1333166400000 , 26.434568573937] , [ 1335758400000 , 25.305617871002] , [ 1338436800000 , 24.520919418236]]
} ,
{
"key" : "Materials" ,
} ,
{
"key" : "Materials" ,
"values" : [ [ 1138683600000 , 5.5806167415681] , [ 1141102800000 , 5.4539047069985] , [ 1143781200000 , 7.6728842432362] , [ 1146369600000 , 7.719946716654] , [ 1149048000000 , 8.0144619912942] , [ 1151640000000 , 7.942223133434] , [ 1154318400000 , 8.3998279827444] , [ 1156996800000 , 8.532324572605] , [ 1159588800000 , 4.7324285199763] , [ 1162270800000 , 4.7402397487697] , [ 1164862800000 , 4.9042069355168] , [ 1167541200000 , 5.9583963430882] , [ 1170219600000 , 6.3693899239171] , [ 1172638800000 , 6.261153903813] , [ 1175313600000 , 5.3443942184584] , [ 1177905600000 , 5.4932111235361] , [ 1180584000000 , 5.5747393101109] , [ 1183176000000 , 5.3833633060013] , [ 1185854400000 , 5.5125898831832] , [ 1188532800000 , 5.8116112661327] , [ 1191124800000 , 4.3962296939996] , [ 1193803200000 , 4.6967663605521] , [ 1196398800000 , 4.7963004350914] , [ 1199077200000 , 4.1817985183351] , [ 1201755600000 , 4.3797643870182] , [ 1204261200000 , 4.6966642197965] , [ 1206936000000 , 4.3609995132565] , [ 1209528000000 , 4.4736290996496] , [ 1212206400000 , 4.3749762738128] , [ 1214798400000 , 3.3274661194507] , [ 1217476800000 , 3.0316184691337] , [ 1220155200000 , 2.5718140204728] , [ 1222747200000 , 2.7034994044603] , [ 1225425600000 , 2.2033786591364] , [ 1228021200000 , 1.9850621240805] , [ 1230699600000 , 0] , [ 1233378000000 , 0] , [ 1235797200000 , 0] , [ 1238472000000 , 0] , [ 1241064000000 , 0] , [ 1243742400000 , 0] , [ 1246334400000 , 0] , [ 1249012800000 , 0] , [ 1251691200000 , 0] , [ 1254283200000 , 0.44495950017788] , [ 1256961600000 , 0.33945469262483] , [ 1259557200000 , 0.38348269455195] , [ 1262235600000 , 0] , [ 1264914000000 , 0] , [ 1267333200000 , 0] , [ 1270008000000 , 0] , [ 1272600000000 , 0] , [ 1275278400000 , 0] , [ 1277870400000 , 0] , [ 1280548800000 , 0] , [ 1283227200000 , 0] , [ 1285819200000 , 0] , [ 1288497600000 , 0] , [ 1291093200000 , 0] , [ 1293771600000 , 0] , [ 1296450000000 , 0.52216435716176] , [ 1298869200000 , 0.59275786698454] , [ 1301544000000 , 0] , [ 1304136000000 , 0] , [ 1306814400000 , 0] , [ 1309406400000 , 0] , [ 1312084800000 , 0] , [ 1314763200000 , 0] , [ 1317355200000 , 0] , [ 1320033600000 , 0] , [ 1322629200000 , 0] , [ 1325307600000 , 0] , [ 1327986000000 , 0] , [ 1330491600000 , 0] , [ 1333166400000 , 0] , [ 1335758400000 , 0] , [ 1338436800000 , 0]]
} ,
{
"key" : "Telecommunication Services" ,
} ,
{
"key" : "Telecommunication Services" ,
"values" : [ [ 1138683600000 , 3.7056975170243] , [ 1141102800000 , 3.7561118692318] , [ 1143781200000 , 2.861913700854] , [ 1146369600000 , 2.9933744103381] , [ 1149048000000 , 2.7127537218463] , [ 1151640000000 , 3.1195497076283] , [ 1154318400000 , 3.4066964004508] , [ 1156996800000 , 3.3754571113569] , [ 1159588800000 , 2.2965579982924] , [ 1162270800000 , 2.4486818633018] , [ 1164862800000 , 2.4002308848517] , [ 1167541200000 , 1.9649579750349] , [ 1170219600000 , 1.9385263638056] , [ 1172638800000 , 1.9128975336387] , [ 1175313600000 , 2.3412869836298] , [ 1177905600000 , 2.4337870351445] , [ 1180584000000 , 2.62179703171] , [ 1183176000000 , 3.2642864957929] , [ 1185854400000 , 3.3200396223709] , [ 1188532800000 , 3.3934212707572] , [ 1191124800000 , 4.2822327088179] , [ 1193803200000 , 4.1474964228541] , [ 1196398800000 , 4.1477082879801] , [ 1199077200000 , 5.2947122916128] , [ 1201755600000 , 5.2919843508028] , [ 1204261200000 , 5.1989783050309] , [ 1206936000000 , 3.5603057673513] , [ 1209528000000 , 3.3009087690692] , [ 1212206400000 , 3.1784852603792] , [ 1214798400000 , 4.5889503538868] , [ 1217476800000 , 4.401779617494] , [ 1220155200000 , 4.2208301828278] , [ 1222747200000 , 3.89396671475] , [ 1225425600000 , 3.0423832241354] , [ 1228021200000 , 3.135520611578] , [ 1230699600000 , 1.9631418164089] , [ 1233378000000 , 1.8963543874958] , [ 1235797200000 , 1.8266636017025] , [ 1238472000000 , 0.93136635895188] , [ 1241064000000 , 0.92737801918888] , [ 1243742400000 , 0.97591889805002] , [ 1246334400000 , 2.6841193805515] , [ 1249012800000 , 2.5664341140531] , [ 1251691200000 , 2.3887523699873] , [ 1254283200000 , 1.1737801663681] , [ 1256961600000 , 1.0953582317281] , [ 1259557200000 , 1.2495674976653] , [ 1262235600000 , 0.36607452464754] , [ 1264914000000 , 0.3548719047291] , [ 1267333200000 , 0.36769242398939] , [ 1270008000000 , 0] , [ 1272600000000 , 0] , [ 1275278400000 , 0] , [ 1277870400000 , 0] , [ 1280548800000 , 0] , [ 1283227200000 , 0] , [ 1285819200000 , 0.85450741275337] , [ 1288497600000 , 0.91360317921637] , [ 1291093200000 , 0.89647678692269] , [ 1293771600000 , 0.87800687192639] , [ 1296450000000 , 0] , [ 1298869200000 , 0] , [ 1301544000000 , 0.43668720882994] , [ 1304136000000 , 0.4756523602692] , [ 1306814400000 , 0.46947368328469] , [ 1309406400000 , 0.45138896152316] , [ 1312084800000 , 0.43828726648117] , [ 1314763200000 , 2.0820861395316] , [ 1317355200000 , 0.9364411075395] , [ 1320033600000 , 0.60583907839773] , [ 1322629200000 , 0.61096950747437] , [ 1325307600000 , 0] , [ 1327986000000 , 0] , [ 1330491600000 , 0] , [ 1333166400000 , 0] , [ 1335758400000 , 0] , [ 1338436800000 , 0]]
} ,
{
"key" : "Utilities" ,
} ,
{
"key" : "Utilities" ,
"values" : [ [ 1138683600000 , 0] , [ 1141102800000 , 0] , [ 1143781200000 , 0] , [ 1146369600000 , 0] , [ 1149048000000 , 0] , [ 1151640000000 , 0] , [ 1154318400000 , 0] , [ 1156996800000 , 0] , [ 1159588800000 , 0] , [ 1162270800000 , 0] , [ 1164862800000 , 0] , [ 1167541200000 , 0] , [ 1170219600000 , 0] , [ 1172638800000 , 0] , [ 1175313600000 , 0] , [ 1177905600000 , 0] , [ 1180584000000 , 0] , [ 1183176000000 , 0] , [ 1185854400000 , 0] , [ 1188532800000 , 0] , [ 1191124800000 , 0] , [ 1193803200000 , 0] , [ 1196398800000 , 0] , [ 1199077200000 , 0] , [ 1201755600000 , 0] , [ 1204261200000 , 0] , [ 1206936000000 , 0] , [ 1209528000000 , 0] , [ 1212206400000 , 0] , [ 1214798400000 , 0] , [ 1217476800000 , 0] , [ 1220155200000 , 0] , [ 1222747200000 , 0] , [ 1225425600000 , 0] , [ 1228021200000 , 0] , [ 1230699600000 , 0] , [ 1233378000000 , 0] , [ 1235797200000 , 0] , [ 1238472000000 , 0] , [ 1241064000000 , 0] , [ 1243742400000 , 0] , [ 1246334400000 , 0] , [ 1249012800000 , 0] , [ 1251691200000 , 0] , [ 1254283200000 , 0] , [ 1256961600000 , 0] , [ 1259557200000 , 0] , [ 1262235600000 , 0] , [ 1264914000000 , 0] , [ 1267333200000 , 0] , [ 1270008000000 , 0] , [ 1272600000000 , 0] , [ 1275278400000 , 0] , [ 1277870400000 , 0] , [ 1280548800000 , 0] , [ 1283227200000 , 0] , [ 1285819200000 , 0] , [ 1288497600000 , 0] , [ 1291093200000 , 0] , [ 1293771600000 , 0] , [ 1296450000000 , 0] , [ 1298869200000 , 0] , [ 1301544000000 , 0] , [ 1304136000000 , 0] , [ 1306814400000 , 0] , [ 1309406400000 , 0] , [ 1312084800000 , 0] , [ 1314763200000 , 0] , [ 1317355200000 , 0] , [ 1320033600000 , 0] , [ 1322629200000 , 0] , [ 1325307600000 , 0] , [ 1327986000000 , 0] , [ 1330491600000 , 0] , [ 1333166400000 , 0] , [ 1335758400000 , 0] , [ 1338436800000 , 0]]
}
}
];
/*
@ -99,81 +98,81 @@ var histcatexplong = [
{
"key" : "Energy" ,
"values" : [ [ 1138683600000 , 1.544303464167]]
} ,
{
"key" : "Financials" ,
} ,
{
"key" : "Financials" ,
"values" : [ [ 1138683600000 , 13.356778764352]]
} ,
{
"key" : "Health Care" ,
} ,
{
"key" : "Health Care" ,
"values" : [ [ 1138683600000 , 14.212410956029]]
} ,
{
"key" : "Industrials" ,
} ,
{
"key" : "Industrials" ,
"values" : [ [ 1138683600000 , 7.1590087090398]]
} ,
{
"key" : "Information Technology" ,
} ,
{
"key" : "Information Technology" ,
"values" : [ [ 1138683600000 , 13.242301508051]]
} ,
{
"key" : "Materials" ,
} ,
{
"key" : "Materials" ,
"values" : [ [ 1138683600000 , 5.5806167415681]]
} ,
{
"key" : "Telecommunication Services" ,
} ,
{
"key" : "Telecommunication Services" ,
"values" : [ [ 1138683600000 , 3.7056975170243]]
} ,
{
"key" : "Utilities" ,
} ,
{
"key" : "Utilities" ,
"values" : [ [ 1138683600000 , 0]]
}
}
];
*/
var histcatexpshort = [
{
"key" : "Consumer Staples" ,
var histcatexpshort = [
{
"key" : "Consumer Staples" ,
"values" : [ [ 1138683600000 , 0] , [ 1141102800000 , 0] , [ 1143781200000 , 0] , [ 1146369600000 , 0] , [ 1149048000000 , 0] , [ 1151640000000 , 0] , [ 1154318400000 , 0] , [ 1156996800000 , 0] , [ 1159588800000 , 0] , [ 1162270800000 , 0] , [ 1164862800000 , 0] , [ 1167541200000 , -0.24102139376003] , [ 1170219600000 , -0.69960584365035] , [ 1172638800000 , -0.67365051426185] , [ 1175313600000 , 0] , [ 1177905600000 , 0] , [ 1180584000000 , 0] , [ 1183176000000 , -0.31429312464988] , [ 1185854400000 , -0.90018700397153] , [ 1188532800000 , -0.96926214328714] , [ 1191124800000 , -1.1343386468131] , [ 1193803200000 , -1.1335426595455] , [ 1196398800000 , -1.2327663032424] , [ 1199077200000 , -0.41027135492155] , [ 1201755600000 , -0.41779167524802] , [ 1204261200000 , -0.38133883625885] , [ 1206936000000 , 0] , [ 1209528000000 , -0.32550520320253] , [ 1212206400000 , -0.33185144615505] , [ 1214798400000 , -0.68609668877894] , [ 1217476800000 , -0.70001207744308] , [ 1220155200000 , -0.68378680840919] , [ 1222747200000 , -0.40908783182034] , [ 1225425600000 , -0.39074266525646] , [ 1228021200000 , -0.40358490474562] , [ 1230699600000 , -0.85752207262267] , [ 1233378000000 , -0.74395750438805] , [ 1235797200000 , -0.70718832429489] , [ 1238472000000 , -0.76244465406965] , [ 1241064000000 , -0.67618572591984] , [ 1243742400000 , -0.67649596761402] , [ 1246334400000 , -0.94618002703247] , [ 1249012800000 , -0.95408485581014] , [ 1251691200000 , -0.96272139504276] , [ 1254283200000 , 0] , [ 1256961600000 , 0] , [ 1259557200000 , 0] , [ 1262235600000 , 0] , [ 1264914000000 , 0] , [ 1267333200000 , 0] , [ 1270008000000 , -0.25516420149471] , [ 1272600000000 , -0.24106264576017] , [ 1275278400000 , -0.22802547751448] , [ 1277870400000 , -0.62187524046697] , [ 1280548800000 , -0.72155608677106] , [ 1283227200000 , -0.70221659944774] , [ 1285819200000 , -1.1117002584543] , [ 1288497600000 , -1.190911001336] , [ 1291093200000 , -1.1781082003972] , [ 1293771600000 , -1.2125860264875] , [ 1296450000000 , -1.7748010365657] , [ 1298869200000 , -1.8919594178596] , [ 1301544000000 , -1.7077946421533] , [ 1304136000000 , -2.024238803094] , [ 1306814400000 , -1.9769844081819] , [ 1309406400000 , -2.0730275464065] , [ 1312084800000 , -1.9690128240888] , [ 1314763200000 , -5.5557852269348] , [ 1317355200000 , -7.2527933190641] , [ 1320033600000 , -5.7367677053109] , [ 1322629200000 , -6.0409316206662] , [ 1325307600000 , -4.6511525539195] , [ 1327986000000 , -4.526116059083] , [ 1330491600000 , -4.846292325197] , [ 1333166400000 , -2.2663198779425] , [ 1335758400000 , -2.4172072568564] , [ 1338436800000 , -2.3204729601189]]
} ,
{
"key" : "Consumer Discretionary" ,
} ,
{
"key" : "Consumer Discretionary" ,
"values" : [ [ 1138683600000 , -0.62238434102863] , [ 1141102800000 , -0.61484565039024] , [ 1143781200000 , -1.0769367918668] , [ 1146369600000 , -1.2221156604129] , [ 1149048000000 , -1.2434858263377] , [ 1151640000000 , -0.58606435489597] , [ 1154318400000 , -0.61478911495141] , [ 1156996800000 , -0.61429362688591] , [ 1159588800000 , -1.1168614112788] , [ 1162270800000 , -1.1510268716612] , [ 1164862800000 , -1.1104724164222] , [ 1167541200000 , -1.2298338563471] , [ 1170219600000 , -1.5053664389104] , [ 1172638800000 , -1.5535266372193] , [ 1175313600000 , -3.1690472535854] , [ 1177905600000 , -3.1273013967041] , [ 1180584000000 , -3.155466271777] , [ 1183176000000 , -3.7158562579437] , [ 1185854400000 , -3.8244546635586] , [ 1188532800000 , -3.5524464859972] , [ 1191124800000 , -3.0472339109128] , [ 1193803200000 , -3.064978140815] , [ 1196398800000 , -3.0818130124986] , [ 1199077200000 , -2.9806791138312] , [ 1201755600000 , -3.7360958775824] , [ 1204261200000 , -3.4687841733263] , [ 1206936000000 , -3.3702018615806] , [ 1209528000000 , -3.1982756208679] , [ 1212206400000 , -3.0489433155104] , [ 1214798400000 , -3.7008275605963] , [ 1217476800000 , -3.8980507260892] , [ 1220155200000 , -3.7680083260241] , [ 1222747200000 , -3.2061890012391] , [ 1225425600000 , -2.6727551440484] , [ 1228021200000 , -2.4469327462935] , [ 1230699600000 , -3.0192419668784] , [ 1233378000000 , -2.892958553476] , [ 1235797200000 , -3.1153570053479] , [ 1238472000000 , -2.9927580570711] , [ 1241064000000 , -3.5061796706294] , [ 1243742400000 , -3.2944159516725] , [ 1246334400000 , -3.4154213240617] , [ 1249012800000 , -3.6492125438171] , [ 1251691200000 , -3.6674164998394] , [ 1254283200000 , -4.6271484977727] , [ 1256961600000 , -4.2433407292676] , [ 1259557200000 , -4.4742625247274] , [ 1262235600000 , -5.2078214612359] , [ 1264914000000 , -5.2209579214469] , [ 1267333200000 , -5.4596395756061] , [ 1270008000000 , -5.6906459276584] , [ 1272600000000 , -6.4981737808665] , [ 1275278400000 , -6.2563044048578] , [ 1277870400000 , -6.175479487959] , [ 1280548800000 , -6.6641002427295] , [ 1283227200000 , -6.3648667745556] , [ 1285819200000 , -5.0270168607884] , [ 1288497600000 , -5.1186072976233] , [ 1291093200000 , -5.1127601587872] , [ 1293771600000 , -5.3015262972641] , [ 1296450000000 , -4.4295728671596] , [ 1298869200000 , -4.5488139745696] , [ 1301544000000 , -2.9021260315957] , [ 1304136000000 , -3.1482096241139] , [ 1306814400000 , -2.8648831814763] , [ 1309406400000 , -2.8149423433441] , [ 1312084800000 , -2.6350669145713] , [ 1314763200000 , -5.9871754759038] , [ 1317355200000 , -8.6127555816399] , [ 1320033600000 , -7.0712887348892] , [ 1322629200000 , -7.3930257999857] , [ 1325307600000 , -6.5183071556304] , [ 1327986000000 , -7.4388913793503] , [ 1330491600000 , -8.2134465182649] , [ 1333166400000 , -7.7836036697105] , [ 1335758400000 , -8.0955053683936] , [ 1338436800000 , -8.0981845818893]]
} ,
{
"key" : "Energy" ,
} ,
{
"key" : "Energy" ,
"values" : [ [ 1138683600000 , -0.95707527558303] , [ 1141102800000 , -0.78324346694487] , [ 1143781200000 , -1.2905241058019] , [ 1146369600000 , -1.3880880486779] , [ 1149048000000 , -1.3337247185993] , [ 1151640000000 , -1.0342112071924] , [ 1154318400000 , -1.1264764100183] , [ 1156996800000 , -1.0001002640852] , [ 1159588800000 , -0.85341153093953] , [ 1162270800000 , -0.88452017844596] , [ 1164862800000 , -0.84305725300642] , [ 1167541200000 , -1.0874455682301] , [ 1170219600000 , -1.1714969043168] , [ 1172638800000 , -1.1445856467934] , [ 1175313600000 , -1.1928513334073] , [ 1177905600000 , -1.2365691634265] , [ 1180584000000 , -1.2690940962478] , [ 1183176000000 , -1.662233774695] , [ 1185854400000 , -1.745760538781] , [ 1188532800000 , -1.5209200931271] , [ 1191124800000 , -1.7874791820886] , [ 1193803200000 , -1.7755668105117] , [ 1196398800000 , -1.5456069064618] , [ 1199077200000 , -1.7077541586335] , [ 1201755600000 , -1.6462081650757] , [ 1204261200000 , -1.8624735339628] , [ 1206936000000 , -0.71073453533048] , [ 1209528000000 , -0.75380709640219] , [ 1212206400000 , -0.71020554911716] , [ 1214798400000 , -1.2077850914504] , [ 1217476800000 , -1.0505576787644] , [ 1220155200000 , -0.97804595164878] , [ 1222747200000 , -0.34591294663671] , [ 1225425600000 , -0.19958331514025] , [ 1228021200000 , -0.17599782216296] , [ 1230699600000 , -0.49577714121027] , [ 1233378000000 , -0.51644059173978] , [ 1235797200000 , -0.48576859637083] , [ 1238472000000 , -0.75596531126452] , [ 1241064000000 , -0.72073358315801] , [ 1243742400000 , -0.82125996732294] , [ 1246334400000 , -1.4933216860121] , [ 1249012800000 , -1.5003760525933] , [ 1251691200000 , -1.4744921420596] , [ 1254283200000 , -1.8197844060652] , [ 1256961600000 , -1.6558574419626] , [ 1259557200000 , -1.7256149254159] , [ 1262235600000 , -2.7667194124217] , [ 1264914000000 , -2.9113351806903] , [ 1267333200000 , -3.0172806042796] , [ 1270008000000 , -2.8607175559701] , [ 1272600000000 , -2.629226972169] , [ 1275278400000 , -2.1855196883832] , [ 1277870400000 , 0] , [ 1280548800000 , 0] , [ 1283227200000 , 0] , [ 1285819200000 , -1.3788733828844] , [ 1288497600000 , -1.4136792139765] , [ 1291093200000 , -1.5176522942901] , [ 1293771600000 , -1.5776651933208] , [ 1296450000000 , -1.7171675182182] , [ 1298869200000 , -1.8121885250566] , [ 1301544000000 , -1.2221934283206] , [ 1304136000000 , -1.2910715239439] , [ 1306814400000 , -1.1492301612576] , [ 1309406400000 , -1.0613891302841] , [ 1312084800000 , -0.99605193205308] , [ 1314763200000 , -1.7324212072278] , [ 1317355200000 , -1.5226856867477] , [ 1320033600000 , -1.3159138896549] , [ 1322629200000 , -1.3925952659299] , [ 1325307600000 , -1.59624913621] , [ 1327986000000 , -1.5235879880296] , [ 1330491600000 , -1.7315573519279] , [ 1333166400000 , -0.86883431220926] , [ 1335758400000 , -0.90144871282829] , [ 1338436800000 , -0.7010492182517]]
} ,
{
"key" : "Financials" ,
} ,
{
"key" : "Financials" ,
"values" : [ [ 1138683600000 , -0.56797103580254] , [ 1141102800000 , -0.57324319174933] , [ 1143781200000 , -1.1014818753272] , [ 1146369600000 , -1.1480256918118] , [ 1149048000000 , -1.0709335336775] , [ 1151640000000 , -0.84876993929658] , [ 1154318400000 , -0.88122638919979] , [ 1156996800000 , -0.86421146074279] , [ 1159588800000 , -0.95093689377974] , [ 1162270800000 , -0.96646862382248] , [ 1164862800000 , -0.96726919442167] , [ 1167541200000 , -0.99874655234936] , [ 1170219600000 , -1.0004843898938] , [ 1172638800000 , -0.9925349676815] , [ 1175313600000 , -1.1888941931287] , [ 1177905600000 , -1.9402228220929] , [ 1180584000000 , -2.03915987194] , [ 1183176000000 , -2.4620526931074] , [ 1185854400000 , -2.2423544651877] , [ 1188532800000 , -1.8790998536037] , [ 1191124800000 , -0.43246873489492] , [ 1193803200000 , -0.40142684216371] , [ 1196398800000 , -0.35646635110466] , [ 1199077200000 , -0.90385702817642] , [ 1201755600000 , -0.86997575249605] , [ 1204261200000 , -0.80101406775415] , [ 1206936000000 , 0] , [ 1209528000000 , 0] , [ 1212206400000 , 0] , [ 1214798400000 , -0.31816167663298] , [ 1217476800000 , -0.309250081849] , [ 1220155200000 , -0.27723698582762] , [ 1222747200000 , -0.32001379372079] , [ 1225425600000 , -0.1940212908561] , [ 1228021200000 , -0.051964569203423] , [ 1230699600000 , -0.68342686502452] , [ 1233378000000 , -0.57645644730726] , [ 1235797200000 , -0.50860972184555] , [ 1238472000000 , -0.44405217759605] , [ 1241064000000 , -0.45224333626901] , [ 1243742400000 , -0.41691818252313] , [ 1246334400000 , -2.4654561579904] , [ 1249012800000 , -2.5473566378551] , [ 1251691200000 , -2.8340604021307] , [ 1254283200000 , -1.8452445924041] , [ 1256961600000 , -1.5626544265386] , [ 1259557200000 , -1.707842764916] , [ 1262235600000 , -1.2237258567344] , [ 1264914000000 , -1.9756896168227] , [ 1267333200000 , -2.0920321696833] , [ 1270008000000 , -1.9782327706952] , [ 1272600000000 , -2.0416328165753] , [ 1275278400000 , -1.7816736134798] , [ 1277870400000 , -0.66092275437689] , [ 1280548800000 , -0.73608099025756] , [ 1283227200000 , -0.63686713461189] , [ 1285819200000 , -0.0024159482973197] , [ 1288497600000 , -0.0023052643588188] , [ 1291093200000 , -0.0023008251965446] , [ 1293771600000 , -0.002247807834351] , [ 1296450000000 , -0.62004345920743] , [ 1298869200000 , -0.69634926653235] , [ 1301544000000 , -0.76013525555354] , [ 1304136000000 , -1.505368495849] , [ 1306814400000 , -1.3456949237707] , [ 1309406400000 , -1.3013934898695] , [ 1312084800000 , -1.183199519395] , [ 1314763200000 , -0.0074317809719494] , [ 1317355200000 , -0.019430458325379] , [ 1320033600000 , -0.015777413509084] , [ 1322629200000 , -0.016463879837718] , [ 1325307600000 , -0.0031338919976225] , [ 1327986000000 , -0.0029770278967514] , [ 1330491600000 , -0.003048902987439] , [ 1333166400000 , -0.71171545945298] , [ 1335758400000 , -0.72003299240508] , [ 1338436800000 , -0.72961974845039]]
} ,
{
"key" : "Health Care" ,
} ,
{
"key" : "Health Care" ,
"values" : [ [ 1138683600000 , 0] , [ 1141102800000 , 0] , [ 1143781200000 , 0] , [ 1146369600000 , 0] , [ 1149048000000 , 0] , [ 1151640000000 , 0] , [ 1154318400000 , 0] , [ 1156996800000 , 0] , [ 1159588800000 , 0] , [ 1162270800000 , 0] , [ 1164862800000 , 0] , [ 1167541200000 , 0] , [ 1170219600000 , 0] , [ 1172638800000 , 0] , [ 1175313600000 , 0] , [ 1177905600000 , 0] , [ 1180584000000 , 0] , [ 1183176000000 , -0.16816074963595] , [ 1185854400000 , -0.19318598121302] , [ 1188532800000 , -0.20130864403797] , [ 1191124800000 , 0] , [ 1193803200000 , 0] , [ 1196398800000 , 0] , [ 1199077200000 , 0] , [ 1201755600000 , 0] , [ 1204261200000 , 0] , [ 1206936000000 , 0] , [ 1209528000000 , 0] , [ 1212206400000 , 0] , [ 1214798400000 , -0.30476443991021] , [ 1217476800000 , -0.31836730824777] , [ 1220155200000 , -0.30797427879366] , [ 1222747200000 , -0.48318623977865] , [ 1225425600000 , -0.50834562674351] , [ 1228021200000 , -0.47936068182503] , [ 1230699600000 , -0.61753010081956] , [ 1233378000000 , -0.59493587396819] , [ 1235797200000 , -0.62664324339064] , [ 1238472000000 , 0] , [ 1241064000000 , 0] , [ 1243742400000 , 0] , [ 1246334400000 , 0] , [ 1249012800000 , 0] , [ 1251691200000 , 0] , [ 1254283200000 , -1.3076157801726] , [ 1256961600000 , -1.2306204787628] , [ 1259557200000 , -1.4728435992801] , [ 1262235600000 , -1.7729831226837] , [ 1264914000000 , -1.7711733839842] , [ 1267333200000 , -1.8233584472099] , [ 1270008000000 , -1.8505979461969] , [ 1272600000000 , -1.5989071613823] , [ 1275278400000 , -1.6636770720413] , [ 1277870400000 , -1.4523909758725] , [ 1280548800000 , -1.503771584105] , [ 1283227200000 , -1.5458561450475] , [ 1285819200000 , -1.457331837483] , [ 1288497600000 , -1.4217332434071] , [ 1291093200000 , -1.4687927303394] , [ 1293771600000 , -1.437223057967] , [ 1296450000000 , -0.72221871524334] , [ 1298869200000 , -0.7399575414588] , [ 1301544000000 , -1.9712239746745] , [ 1304136000000 , -2.2360949351942] , [ 1306814400000 , -2.2147572530541] , [ 1309406400000 , -2.0440932285023] , [ 1312084800000 , -1.9438209561938] , [ 1314763200000 , -4.9035620630386] , [ 1317355200000 , -4.9036674804213] , [ 1320033600000 , -4.1900706458801] , [ 1322629200000 , -4.5602615827955] , [ 1325307600000 , -1.9194421885814] , [ 1327986000000 , -1.8854470816382] , [ 1330491600000 , -1.9514785018245] , [ 1333166400000 , -0.65282205870454] , [ 1335758400000 , -0.57068368199209] , [ 1338436800000 , -0.55902563384907]]
} ,
{
"key" : "Industrials" ,
} ,
{
"key" : "Industrials" ,
"values" : [ [ 1138683600000 , -0.390983707093] , [ 1141102800000 , -0.38471122730537] , [ 1143781200000 , -0.22897173467143] , [ 1146369600000 , -0.23798946472286] , [ 1149048000000 , -0.20721233428173] , [ 1151640000000 , -0.54577697700394] , [ 1154318400000 , -0.50300252995937] , [ 1156996800000 , -0.49609518628103] , [ 1159588800000 , -0.19582276889273] , [ 1162270800000 , -0.60399139945108] , [ 1164862800000 , -0.61477368082886] , [ 1167541200000 , -0.13665869881705] , [ 1170219600000 , -0.13147565243332] , [ 1172638800000 , -0.11819441593356] , [ 1175313600000 , -0.41610825689528] , [ 1177905600000 , -0.38815419659358] , [ 1180584000000 , -0.3703838943035] , [ 1183176000000 , -1.6193903804534] , [ 1185854400000 , -1.6502660417328] , [ 1188532800000 , -1.481875010149] , [ 1191124800000 , -0.96180099322536] , [ 1193803200000 , -0.97017301394967] , [ 1196398800000 , -0.97432971260093] , [ 1199077200000 , -0.36071934518387] , [ 1201755600000 , -0.42150070991777] , [ 1204261200000 , -0.41784042793202] , [ 1206936000000 , -0.70494708349169] , [ 1209528000000 , -0.73449590911984] , [ 1212206400000 , -0.7400163600788] , [ 1214798400000 , -0.52584502195668] , [ 1217476800000 , -0.56224806965368] , [ 1220155200000 , -0.50830855192741] , [ 1222747200000 , -0.79494637898049] , [ 1225425600000 , -0.70391433947286] , [ 1228021200000 , -0.61420660317009] , [ 1230699600000 , -0.41699636242004] , [ 1233378000000 , -0.3779041158185] , [ 1235797200000 , -0.34282498854047] , [ 1238472000000 , -0.83845630450592] , [ 1241064000000 , -0.85937944918912] , [ 1243742400000 , -0.85530287999615] , [ 1246334400000 , -1.2819866264007] , [ 1249012800000 , -1.4598491663715] , [ 1251691200000 , -1.5261472177779] , [ 1254283200000 , -1.2503948993549] , [ 1256961600000 , -1.1767079775724] , [ 1259557200000 , -1.2585538260386] , [ 1262235600000 , -3.420972598165] , [ 1264914000000 , -3.3381337072954] , [ 1267333200000 , -3.7043129330694] , [ 1270008000000 , -4.6924500756609] , [ 1272600000000 , -4.6880683704908] , [ 1275278400000 , -4.3335249071719] , [ 1277870400000 , -3.6545810416445] , [ 1280548800000 , -4.1639787701262] , [ 1283227200000 , -3.8249597612047] , [ 1285819200000 , -0.33221815335641] , [ 1288497600000 , -0.33346468179047] , [ 1291093200000 , -0.34546911228789] , [ 1293771600000 , -0.36609971997147] , [ 1296450000000 , -0.42502545672607] , [ 1298869200000 , -0.38192733348507] , [ 1301544000000 , -0.01991033447621] , [ 1304136000000 , -0.020319195299659] , [ 1306814400000 , -0.018147820835144] , [ 1309406400000 , -0.017923186209383] , [ 1312084800000 , -0.016133999253684] , [ 1314763200000 , -0.72058656278977] , [ 1317355200000 , -0.42812646564889] , [ 1320033600000 , -0.35896134792589] , [ 1322629200000 , -0.38637896444549] , [ 1325307600000 , -0.31794663984021] , [ 1327986000000 , -0.32220831831888] , [ 1330491600000 , -0.37107872672214] , [ 1333166400000 , -0.81968633933695] , [ 1335758400000 , -0.77148300885994] , [ 1338436800000 , -0.77392261735539]]
} ,
{
"key" : "Information Technology" ,
} ,
{
"key" : "Information Technology" ,
"values" : [ [ 1138683600000 , -0.86346955704548] , [ 1141102800000 , -0.88352373534584] , [ 1143781200000 , -1.2630802711685] , [ 1146369600000 , -1.2352593999242] , [ 1149048000000 , -1.2086379045093] , [ 1151640000000 , -1.0416778473647] , [ 1154318400000 , -0.99326278105154] , [ 1156996800000 , -1.0095045907007] , [ 1159588800000 , -2.0762515478576] , [ 1162270800000 , -2.13066829429] , [ 1164862800000 , -2.2458400474235] , [ 1167541200000 , -2.1315262677135] , [ 1170219600000 , -2.4063108252146] , [ 1172638800000 , -2.3753290631454] , [ 1175313600000 , -2.1119577565913] , [ 1177905600000 , -2.1546804750397] , [ 1180584000000 , -2.3768374034303] , [ 1183176000000 , -1.244878330098] , [ 1185854400000 , -1.2233210265236] , [ 1188532800000 , -1.1715073644317] , [ 1191124800000 , -1.0036136395928] , [ 1193803200000 , -0.9510676777939] , [ 1196398800000 , -0.97553526602196] , [ 1199077200000 , -1.9083849411912] , [ 1201755600000 , -1.855965027796] , [ 1204261200000 , -1.7343633512402] , [ 1206936000000 , -2.1847032903649] , [ 1209528000000 , -2.2095446284368] , [ 1212206400000 , -2.2060678671735] , [ 1214798400000 , -1.0941627910924] , [ 1217476800000 , -1.0004352405294] , [ 1220155200000 , -0.93563501378075] , [ 1222747200000 , 0] , [ 1225425600000 , -0.65155092645953] , [ 1228021200000 , -0.66021585164047] , [ 1230699600000 , 0] , [ 1233378000000 , 0] , [ 1235797200000 , 0] , [ 1238472000000 , 0] , [ 1241064000000 , 0] , [ 1243742400000 , 0] , [ 1246334400000 , 0] , [ 1249012800000 , 0] , [ 1251691200000 , 0] , [ 1254283200000 , -0.29297573068109] , [ 1256961600000 , -0.75043756379084] , [ 1259557200000 , -0.85690846482745] , [ 1262235600000 , -0.21937480770873] , [ 1264914000000 , -0.93232569935343] , [ 1267333200000 , -0.94180327525084] , [ 1270008000000 , 0] , [ 1272600000000 , 0] , [ 1275278400000 , 0] , [ 1277870400000 , 0] , [ 1280548800000 , 0] , [ 1283227200000 , 0] , [ 1285819200000 , -0.21253553193891] , [ 1288497600000 , -0.23178244747722] , [ 1291093200000 , -0.21481706129968] , [ 1293771600000 , -0.23306463011242] , [ 1296450000000 , -0.90244048159158] , [ 1298869200000 , -1.0410052083529] , [ 1301544000000 , -2.209350937089] , [ 1304136000000 , -2.6540796712932] , [ 1306814400000 , -3.2481210590957] , [ 1309406400000 , -3.0717986354635] , [ 1312084800000 , -2.7493296528921] , [ 1314763200000 , -2.1973991293256] , [ 1317355200000 , -0.86403111842659] , [ 1320033600000 , -0.87824756160219] , [ 1322629200000 , -0.80812571482871] , [ 1325307600000 , -1.6419820357151] , [ 1327986000000 , -1.6893790342619] , [ 1330491600000 , -1.8614499455474] , [ 1333166400000 , -1.814727017516] , [ 1335758400000 , -1.8744942128618] , [ 1338436800000 , -1.7880124850882]]
} ,
{
"key" : "Materials" ,
} ,
{
"key" : "Materials" ,
"values" : [ [ 1138683600000 , -0.26079769654951] , [ 1141102800000 , -0.23368425410881] , [ 1143781200000 , -0.46285283466193] , [ 1146369600000 , -0.4588429059205] , [ 1149048000000 , -0.43055120080853] , [ 1151640000000 , -0.26428963363642] , [ 1154318400000 , -0.26203611963364] , [ 1156996800000 , -0.26706156717825] , [ 1159588800000 , -0.024613610779192] , [ 1162270800000 , -0.024351047945929] , [ 1164862800000 , -0.031497065480344] , [ 1167541200000 , 0] , [ 1170219600000 , 0] , [ 1172638800000 , 0] , [ 1175313600000 , 0] , [ 1177905600000 , 0] , [ 1180584000000 , 0] , [ 1183176000000 , 0] , [ 1185854400000 , 0] , [ 1188532800000 , 0] , [ 1191124800000 , 0] , [ 1193803200000 , 0] , [ 1196398800000 , 0] , [ 1199077200000 , 0] , [ 1201755600000 , 0] , [ 1204261200000 , 0] , [ 1206936000000 , -0.83875613435932] , [ 1209528000000 , -0.84367445572656] , [ 1212206400000 , -0.78928126005463] , [ 1214798400000 , -1.1075954825404] , [ 1217476800000 , -1.2704836497926] , [ 1220155200000 , -1.307504052056] , [ 1222747200000 , -0.70440409992826] , [ 1225425600000 , -0.74122140007729] , [ 1228021200000 , -0.82224393045109] , [ 1230699600000 , -1.8719055314571] , [ 1233378000000 , -1.5200311233975] , [ 1235797200000 , -1.5552386899059] , [ 1238472000000 , -1.1576593040773] , [ 1241064000000 , -1.0757811060575] , [ 1243742400000 , -1.0250125722511] , [ 1246334400000 , -2.2747597224127] , [ 1249012800000 , -2.3125499227974] , [ 1251691200000 , -2.2784386530745] , [ 1254283200000 , -1.1518806233757] , [ 1256961600000 , -1.0075503399018] , [ 1259557200000 , -1.1400577929481] , [ 1262235600000 , -0.50677891891165] , [ 1264914000000 , -0.54332908490051] , [ 1267333200000 , -0.55473181189807] , [ 1270008000000 , -0.3633796157757] , [ 1272600000000 , -0.30361861470847] , [ 1275278400000 , -0.24614951229153] , [ 1277870400000 , -1.0959443687647] , [ 1280548800000 , -1.1881529264637] , [ 1283227200000 , -1.1835349242596] , [ 1285819200000 , -0.92507477884561] , [ 1288497600000 , -0.94531016133473] , [ 1291093200000 , -0.93519433603434] , [ 1293771600000 , -1.009221344252] , [ 1296450000000 , -2.3640716285835] , [ 1298869200000 , -2.4914494188556] , [ 1301544000000 , -1.7979456141716] , [ 1304136000000 , -2.1389760840247] , [ 1306814400000 , -1.9721362241269] , [ 1309406400000 , -1.9170229522382] , [ 1312084800000 , -1.8076246545605] , [ 1314763200000 , -2.1010686108381] , [ 1317355200000 , -2.2396373791195] , [ 1320033600000 , -1.8469012813015] , [ 1322629200000 , -2.0079125997321] , [ 1325307600000 , -1.9170007806182] , [ 1327986000000 , -1.9239118384243] , [ 1330491600000 , -2.0649464738798] , [ 1333166400000 , -0.88385747789351] , [ 1335758400000 , -0.91438087144161] , [ 1338436800000 , -0.96513752020965]]
} ,
{
"key" : "Telecommunication Services" ,
} ,
{
"key" : "Telecommunication Services" ,
"values" : [ [ 1138683600000 , 0] , [ 1141102800000 , 0] , [ 1143781200000 , -0.077395192503573] , [ 1146369600000 , -0.079342784160835] , [ 1149048000000 , -0.07376956808809] , [ 1151640000000 , -0.041850521681201] , [ 1154318400000 , -0.037598545052499] , [ 1156996800000 , -0.040984079427717] , [ 1159588800000 , -0.19335817797448] , [ 1162270800000 , -0.18578493919925] , [ 1164862800000 , -0.1769473933101] , [ 1167541200000 , -0.57245352054975] , [ 1170219600000 , -0.61554187332911] , [ 1172638800000 , -0.63016714701151] , [ 1175313600000 , 0] , [ 1177905600000 , 0] , [ 1180584000000 , 0] , [ 1183176000000 , -0.12118014109021] , [ 1185854400000 , -0.11085831487208] , [ 1188532800000 , -0.10901265358445] , [ 1191124800000 , -0.17205583275088] , [ 1193803200000 , -0.16573676303991] , [ 1196398800000 , -0.17954841680392] , [ 1199077200000 , -0.82703336198161] , [ 1201755600000 , -0.76741763304227] , [ 1204261200000 , -0.79430844816827] , [ 1206936000000 , -1.0279404050708] , [ 1209528000000 , -1.0342425093761] , [ 1212206400000 , -1.0903083860383] , [ 1214798400000 , -1.0895432841007] , [ 1217476800000 , -1.1392703218146] , [ 1220155200000 , -0.98872086340391] , [ 1222747200000 , -1.227654651568] , [ 1225425600000 , -1.0527419580394] , [ 1228021200000 , -0.84338280322309] , [ 1230699600000 , -0.5982617279246] , [ 1233378000000 , -0.74123723862634] , [ 1235797200000 , -0.81665712408277] , [ 1238472000000 , -0.89868760705228] , [ 1241064000000 , -0.86338472153689] , [ 1243742400000 , -0.85040889603889] , [ 1246334400000 , -0.82872733882926] , [ 1249012800000 , -1.2797824676355] , [ 1251691200000 , -1.152043882336] , [ 1254283200000 , -0.70125890680538] , [ 1256961600000 , -0.69496338525418] , [ 1259557200000 , -0.81982038022784] , [ 1262235600000 , -0.42841700219624] , [ 1264914000000 , -0.43298861575253] , [ 1267333200000 , -0.46951194437705] , [ 1270008000000 , -0.46723980191721] , [ 1272600000000 , -0.43139262322841] , [ 1275278400000 , -0.4052075794202] , [ 1277870400000 , -0.45399431179247] , [ 1280548800000 , -0.50492374473014] , [ 1283227200000 , -0.49032976375464] , [ 1285819200000 , -0.95769381063728] , [ 1288497600000 , -0.92968381683254] , [ 1291093200000 , -0.90984207437415] , [ 1293771600000 , -0.91448295661871] , [ 1296450000000 , -1.3204103334172] , [ 1298869200000 , -1.3896989018] , [ 1301544000000 , -1.8536993972883] , [ 1304136000000 , -1.9901582471947] , [ 1306814400000 , -1.8731097808809] , [ 1309406400000 , -1.8109819859122] , [ 1312084800000 , -1.7946593386661] , [ 1314763200000 , -1.6002716669781] , [ 1317355200000 , -0.056479286204019] , [ 1320033600000 , -0.046232413998891] , [ 1322629200000 , -0.051182355563531] , [ 1325307600000 , -0.032858749040145] , [ 1327986000000 , -0.032326418106178] , [ 1330491600000 , -0.033980477379241] , [ 1333166400000 , -0.053069550536519] , [ 1335758400000 , -0.055741850564434] , [ 1338436800000 , -0.055851808568252]]
} ,
{
"key" : "Utilities" ,
} ,
{
"key" : "Utilities" ,
"values" : [ [ 1138683600000 , 0] , [ 1141102800000 , 0] , [ 1143781200000 , -0.073769471773675] , [ 1146369600000 , -0.077824496315782] , [ 1149048000000 , -0.080696288096361] , [ 1151640000000 , 0] , [ 1154318400000 , 0] , [ 1156996800000 , 0] , [ 1159588800000 , 0] , [ 1162270800000 , 0] , [ 1164862800000 , 0] , [ 1167541200000 , 0] , [ 1170219600000 , 0] , [ 1172638800000 , 0] , [ 1175313600000 , 0] , [ 1177905600000 , 0] , [ 1180584000000 , 0] , [ 1183176000000 , -0.16073291656515] , [ 1185854400000 , -0.1646253606633] , [ 1188532800000 , -0.1655815581449] , [ 1191124800000 , -0.74417496631713] , [ 1193803200000 , -0.76230340423681] , [ 1196398800000 , -0.73882938190048] , [ 1199077200000 , -0.3820573391806] , [ 1201755600000 , -0.360757285179] , [ 1204261200000 , -0.38081058463615] , [ 1206936000000 , -0.92767439811083] , [ 1209528000000 , -0.92774728028789] , [ 1212206400000 , -0.85273481694714] , [ 1214798400000 , -1.69407085613] , [ 1217476800000 , -1.5179726219101] , [ 1220155200000 , -1.3576700600738] , [ 1222747200000 , -1.0404839864076] , [ 1225425600000 , -0.95251478838915] , [ 1228021200000 , -1.0610509118017] , [ 1230699600000 , -0.3316792294278] , [ 1233378000000 , -0.33745002288524] , [ 1235797200000 , -0.28806366796683] , [ 1238472000000 , 0] , [ 1241064000000 , 0] , [ 1243742400000 , 0] , [ 1246334400000 , -0.6338555382785] , [ 1249012800000 , -0.62797265130959] , [ 1251691200000 , -0.60264057253794] , [ 1254283200000 , -0.28687231077181] , [ 1256961600000 , -0.22215649778327] , [ 1259557200000 , -0.24027664555676] , [ 1262235600000 , 0] , [ 1264914000000 , 0] , [ 1267333200000 , 0] , [ 1270008000000 , 0] , [ 1272600000000 , 0] , [ 1275278400000 , 0] , [ 1277870400000 , 0] , [ 1280548800000 , 0] , [ 1283227200000 , 0] , [ 1285819200000 , 0] , [ 1288497600000 , 0] , [ 1291093200000 , 0] , [ 1293771600000 , 0] , [ 1296450000000 , 0] , [ 1298869200000 , 0] , [ 1301544000000 , 0] , [ 1304136000000 , 0] , [ 1306814400000 , 0] , [ 1309406400000 , 0] , [ 1312084800000 , 0] , [ 1314763200000 , 0] , [ 1317355200000 , 0] , [ 1320033600000 , 0] , [ 1322629200000 , 0] , [ 1325307600000 , 0] , [ 1327986000000 , 0] , [ 1330491600000 , 0] , [ 1333166400000 , 0] , [ 1335758400000 , 0] , [ 1338436800000 , 0]]
}
}
];
/*
@ -186,7 +185,7 @@ var histcatexpshort = [
*/
//an example of harmonizing colors between visualizations
//observe that Consumer Discretionary and Consumer Staples have
//observe that Consumer Discretionary and Consumer Staples have
//been flipped in the second chart
var colors = d3.scale.category20();
keyColor = function(d, i) {return colors(d.key)};
@ -194,12 +193,9 @@ keyColor = function(d, i) {return colors(d.key)};
var chart;
nv.addGraph(function() {
chart = nv.models.stackedAreaChart()
// .width(600).height(500)
.useInteractiveGuideline(true)
.x(function(d) { return d[0] })
.y(function(d) { return d[1] })
.color(keyColor)
.transitionDuration(300);
//.clipEdge(true);
// chart.stacked.scatter.clipVoronoi(false);
@ -212,30 +208,11 @@ nv.addGraph(function() {
d3.select('#chart1')
.datum(histcatexplong)
.transition().duration(1000)
.call(chart)
// .transition().duration(0)
.each('start', function() {
setTimeout(function() {
d3.selectAll('#chart1 *').each(function() {
console.log('start',this.__transition__, this)
// while(this.__transition__)
if(this.__transition__)
this.__transition__.duration = 1;
})
}, 0)
})
// .each('end', function() {
// d3.selectAll('#chart1 *').each(function() {
// console.log('end', this.__transition__, this)
// // while(this.__transition__)
// if(this.__transition__)
// this.__transition__.duration = 1;
// })});
.transition().duration(500).call(chart);
nv.utils.windowResize(chart.update);
// chart.dispatch.on('stateChange', function(e) { nv.log('New State:', JSON.stringify(e)); });
chart.dispatch.on('stateChange', function(e) { nv.log('New State:', JSON.stringify(e)); });
return chart;
});
@ -244,8 +221,7 @@ nv.addGraph(function() {
var chart = nv.models.stackedAreaChart()
.x(function(d) { return d[0] })
.y(function(d) { return d[1] })
.color(keyColor)
;
.color(keyColor);
//.clipEdge(true);
chart.xAxis
@ -256,7 +232,7 @@ nv.addGraph(function() {
d3.select('#chart2')
.datum(histcatexpshort)
.transition()
//.transition().duration(500)
.call(chart);
nv.utils.windowResize(chart.update);

@ -1,302 +0,0 @@
// This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/).
var colorbrewer = {YlGn: {
3: ["#f7fcb9","#addd8e","#31a354"],
4: ["#ffffcc","#c2e699","#78c679","#238443"],
5: ["#ffffcc","#c2e699","#78c679","#31a354","#006837"],
6: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],
7: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
8: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
9: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]
},YlGnBu: {
3: ["#edf8b1","#7fcdbb","#2c7fb8"],
4: ["#ffffcc","#a1dab4","#41b6c4","#225ea8"],
5: ["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],
6: ["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],
7: ["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],
8: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],
9: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]
},GnBu: {
3: ["#e0f3db","#a8ddb5","#43a2ca"],
4: ["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],
5: ["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],
6: ["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],
7: ["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],
8: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],
9: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"]
},BuGn: {
3: ["#e5f5f9","#99d8c9","#2ca25f"],
4: ["#edf8fb","#b2e2e2","#66c2a4","#238b45"],
5: ["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],
6: ["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],
7: ["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],
8: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],
9: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"]
},PuBuGn: {
3: ["#ece2f0","#a6bddb","#1c9099"],
4: ["#f6eff7","#bdc9e1","#67a9cf","#02818a"],
5: ["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"],
6: ["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],
7: ["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],
8: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],
9: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"]
},PuBu: {
3: ["#ece7f2","#a6bddb","#2b8cbe"],
4: ["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],
5: ["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],
6: ["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],
7: ["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],
8: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],
9: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"]
},BuPu: {
3: ["#e0ecf4","#9ebcda","#8856a7"],
4: ["#edf8fb","#b3cde3","#8c96c6","#88419d"],
5: ["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],
6: ["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],
7: ["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],
8: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],
9: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"]
},RdPu: {
3: ["#fde0dd","#fa9fb5","#c51b8a"],
4: ["#feebe2","#fbb4b9","#f768a1","#ae017e"],
5: ["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],
6: ["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],
7: ["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],
8: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],
9: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"]
},PuRd: {
3: ["#e7e1ef","#c994c7","#dd1c77"],
4: ["#f1eef6","#d7b5d8","#df65b0","#ce1256"],
5: ["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],
6: ["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],
7: ["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],
8: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],
9: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"]
},OrRd: {
3: ["#fee8c8","#fdbb84","#e34a33"],
4: ["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],
5: ["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],
6: ["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],
7: ["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],
8: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],
9: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"]
},YlOrRd: {
3: ["#ffeda0","#feb24c","#f03b20"],
4: ["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],
5: ["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],
6: ["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],
7: ["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],
8: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],
9: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"]
},YlOrBr: {
3: ["#fff7bc","#fec44f","#d95f0e"],
4: ["#ffffd4","#fed98e","#fe9929","#cc4c02"],
5: ["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],
6: ["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],
7: ["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],
8: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],
9: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"]
},Purples: {
3: ["#efedf5","#bcbddc","#756bb1"],
4: ["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],
5: ["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],
6: ["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],
7: ["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],
8: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],
9: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]
},Blues: {
3: ["#deebf7","#9ecae1","#3182bd"],
4: ["#eff3ff","#bdd7e7","#6baed6","#2171b5"],
5: ["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],
6: ["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],
7: ["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],
8: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],
9: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]
},Greens: {
3: ["#e5f5e0","#a1d99b","#31a354"],
4: ["#edf8e9","#bae4b3","#74c476","#238b45"],
5: ["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],
6: ["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],
7: ["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],
8: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],
9: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]
},Oranges: {
3: ["#fee6ce","#fdae6b","#e6550d"],
4: ["#feedde","#fdbe85","#fd8d3c","#d94701"],
5: ["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],
6: ["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],
7: ["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],
8: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],
9: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]
},Reds: {
3: ["#fee0d2","#fc9272","#de2d26"],
4: ["#fee5d9","#fcae91","#fb6a4a","#cb181d"],
5: ["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],
6: ["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],
7: ["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],
8: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],
9: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]
},Greys: {
3: ["#f0f0f0","#bdbdbd","#636363"],
4: ["#f7f7f7","#cccccc","#969696","#525252"],
5: ["#f7f7f7","#cccccc","#969696","#636363","#252525"],
6: ["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],
7: ["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],
8: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],
9: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]
},PuOr: {
3: ["#f1a340","#f7f7f7","#998ec3"],
4: ["#e66101","#fdb863","#b2abd2","#5e3c99"],
5: ["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],
6: ["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],
7: ["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],
8: ["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],
9: ["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],
10: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],
11: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"]
},BrBG: {
3: ["#d8b365","#f5f5f5","#5ab4ac"],
4: ["#a6611a","#dfc27d","#80cdc1","#018571"],
5: ["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],
6: ["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],
7: ["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],
8: ["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],
9: ["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],
10: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],
11: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]
},PRGn: {
3: ["#af8dc3","#f7f7f7","#7fbf7b"],
4: ["#7b3294","#c2a5cf","#a6dba0","#008837"],
5: ["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],
6: ["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],
7: ["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],
8: ["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],
9: ["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],
10: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],
11: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]
},PiYG: {
3: ["#e9a3c9","#f7f7f7","#a1d76a"],
4: ["#d01c8b","#f1b6da","#b8e186","#4dac26"],
5: ["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],
6: ["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],
7: ["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],
8: ["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],
9: ["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],
10: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],
11: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]
},RdBu: {
3: ["#ef8a62","#f7f7f7","#67a9cf"],
4: ["#ca0020","#f4a582","#92c5de","#0571b0"],
5: ["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],
6: ["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],
7: ["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],
8: ["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],
9: ["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],
10: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],
11: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]
},RdGy: {
3: ["#ef8a62","#ffffff","#999999"],
4: ["#ca0020","#f4a582","#bababa","#404040"],
5: ["#ca0020","#f4a582","#ffffff","#bababa","#404040"],
6: ["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],
7: ["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],
8: ["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],
9: ["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],
10: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],
11: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"]
},RdYlBu: {
3: ["#fc8d59","#ffffbf","#91bfdb"],
4: ["#d7191c","#fdae61","#abd9e9","#2c7bb6"],
5: ["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],
6: ["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],
7: ["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],
8: ["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],
9: ["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],
10: ["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],
11: ["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]
},Spectral: {
3: ["#fc8d59","#ffffbf","#99d594"],
4: ["#d7191c","#fdae61","#abdda4","#2b83ba"],
5: ["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],
6: ["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],
7: ["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"],
8: ["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],
9: ["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],
10: ["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],
11: ["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]
},RdYlGn: {
3: ["#fc8d59","#ffffbf","#91cf60"],
4: ["#d7191c","#fdae61","#a6d96a","#1a9641"],
5: ["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],
6: ["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],
7: ["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],
8: ["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],
9: ["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],
10: ["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],
11: ["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]
},Accent: {
3: ["#7fc97f","#beaed4","#fdc086"],
4: ["#7fc97f","#beaed4","#fdc086","#ffff99"],
5: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],
6: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],
7: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],
8: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"]
},Dark2: {
3: ["#1b9e77","#d95f02","#7570b3"],
4: ["#1b9e77","#d95f02","#7570b3","#e7298a"],
5: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],
6: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],
7: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],
8: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"]
},Paired: {
3: ["#a6cee3","#1f78b4","#b2df8a"],
4: ["#a6cee3","#1f78b4","#b2df8a","#33a02c"],
5: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],
6: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],
7: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],
8: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],
9: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],
10: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],
11: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],
12: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]
},Pastel1: {
3: ["#fbb4ae","#b3cde3","#ccebc5"],
4: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],
5: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],
6: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],
7: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],
8: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],
9: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]
},Pastel2: {
3: ["#b3e2cd","#fdcdac","#cbd5e8"],
4: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],
5: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],
6: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],
7: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],
8: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"]
},Set1: {
3: ["#e41a1c","#377eb8","#4daf4a"],
4: ["#e41a1c","#377eb8","#4daf4a","#984ea3"],
5: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],
6: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],
7: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],
8: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],
9: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]
},Set2: {
3: ["#66c2a5","#fc8d62","#8da0cb"],
4: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],
5: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],
6: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"],
7: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"],
8: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"]
},Set3: {
3: ["#8dd3c7","#ffffb3","#bebada"],
4: ["#8dd3c7","#ffffb3","#bebada","#fb8072"],
5: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"],
6: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"],
7: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"],
8: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"],
9: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"],
10: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"],
11: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"],
12: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]
}};

@ -1,769 +0,0 @@
/********************
* HTML CSS
*/
.chartWrap {
margin: 0;
padding: 0;
overflow: hidden;
}
/********************
Box shadow and border radius styling
*/
.nvtooltip.with-3d-shadow, .with-3d-shadow .nvtooltip {
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
box-shadow: 0 5px 10px rgba(0,0,0,.2);
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}
/********************
* TOOLTIP CSS
*/
.nvtooltip {
position: absolute;
background-color: rgba(255,255,255,1.0);
padding: 1px;
border: 1px solid rgba(0,0,0,.2);
z-index: 10000;
font-family: Arial;
font-size: 13px;
text-align: left;
pointer-events: none;
white-space: nowrap;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/*Give tooltips that old fade in transition by
putting a "with-transitions" class on the container div.
*/
.nvtooltip.with-transitions, .with-transitions .nvtooltip {
transition: opacity 250ms linear;
-moz-transition: opacity 250ms linear;
-webkit-transition: opacity 250ms linear;
transition-delay: 250ms;
-moz-transition-delay: 250ms;
-webkit-transition-delay: 250ms;
}
.nvtooltip.x-nvtooltip,
.nvtooltip.y-nvtooltip {
padding: 8px;
}
.nvtooltip h3 {
margin: 0;
padding: 4px 14px;
line-height: 18px;
font-weight: normal;
background-color: rgba(247,247,247,0.75);
text-align: center;
border-bottom: 1px solid #ebebeb;
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
.nvtooltip p {
margin: 0;
padding: 5px 14px;
text-align: center;
}
.nvtooltip span {
display: inline-block;
margin: 2px 0;
}
.nvtooltip table {
margin: 6px;
border-spacing:0;
}
.nvtooltip table td {
padding: 2px 9px 2px 0;
vertical-align: middle;
}
.nvtooltip table td.key {
font-weight:normal;
}
.nvtooltip table td.value {
text-align: right;
font-weight: bold;
}
.nvtooltip table tr.highlight td {
padding: 1px 9px 1px 0;
border-bottom-style: solid;
border-bottom-width: 1px;
border-top-style: solid;
border-top-width: 1px;
}
.nvtooltip table td.legend-color-guide div {
width: 8px;
height: 8px;
vertical-align: middle;
}
.nvtooltip .footer {
padding: 3px;
text-align: center;
}
.nvtooltip-pending-removal {
position: absolute;
pointer-events: none;
}
/********************
* SVG CSS
*/
svg {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
/* Trying to get SVG to act like a greedy block in all browsers */
display: block;
width:100%;
height:100%;
}
svg text {
font: normal 12px Arial;
}
svg .title {
font: bold 14px Arial;
}
.nvd3 .nv-background {
fill: white;
fill-opacity: 0;
/*
pointer-events: none;
*/
}
.nvd3.nv-noData {
font-size: 18px;
font-weight: bold;
}
/**********
* Brush
*/
.nv-brush .extent {
fill-opacity: .125;
shape-rendering: crispEdges;
}
/**********
* Legend
*/
.nvd3 .nv-legend .nv-series {
cursor: pointer;
}
.nvd3 .nv-legend .disabled circle {
fill-opacity: 0;
}
/**********
* Axes
*/
.nvd3 .nv-axis {
pointer-events:none;
}
.nvd3 .nv-axis path {
fill: none;
stroke: #000;
stroke-opacity: .75;
shape-rendering: crispEdges;
}
.nvd3 .nv-axis path.domain {
stroke-opacity: .75;
}
.nvd3 .nv-axis.nv-x path.domain {
stroke-opacity: 0;
}
.nvd3 .nv-axis line {
fill: none;
stroke: #e5e5e5;
shape-rendering: crispEdges;
}
.nvd3 .nv-axis .zero line,
/*this selector may not be necessary*/ .nvd3 .nv-axis line.zero {
stroke-opacity: .75;
}
.nvd3 .nv-axis .nv-axisMaxMin text {
font-weight: bold;
}
.nvd3 .x .nv-axis .nv-axisMaxMin text,
.nvd3 .x2 .nv-axis .nv-axisMaxMin text,
.nvd3 .x3 .nv-axis .nv-axisMaxMin text {
text-anchor: middle
}
/**********
* Brush
*/
.nv-brush .resize path {
fill: #eee;
stroke: #666;
}
/**********
* Bars
*/
.nvd3 .nv-bars .negative rect {
zfill: brown;
}
.nvd3 .nv-bars rect {
zfill: steelblue;
fill-opacity: .75;
transition: fill-opacity 250ms linear;
-moz-transition: fill-opacity 250ms linear;
-webkit-transition: fill-opacity 250ms linear;
}
.nvd3 .nv-bars rect.hover {
fill-opacity: 1;
}
.nvd3 .nv-bars .hover rect {
fill: lightblue;
}
.nvd3 .nv-bars text {
fill: rgba(0,0,0,0);
}
.nvd3 .nv-bars .hover text {
fill: rgba(0,0,0,1);
}
/**********
* Bars
*/
.nvd3 .nv-multibar .nv-groups rect,
.nvd3 .nv-multibarHorizontal .nv-groups rect,
.nvd3 .nv-discretebar .nv-groups rect {
stroke-opacity: 0;
transition: fill-opacity 250ms linear;
-moz-transition: fill-opacity 250ms linear;
-webkit-transition: fill-opacity 250ms linear;
}
.nvd3 .nv-multibar .nv-groups rect:hover,
.nvd3 .nv-multibarHorizontal .nv-groups rect:hover,
.nvd3 .nv-discretebar .nv-groups rect:hover {
fill-opacity: 1;
}
.nvd3 .nv-discretebar .nv-groups text,
.nvd3 .nv-multibarHorizontal .nv-groups text {
font-weight: bold;
fill: rgba(0,0,0,1);
stroke: rgba(0,0,0,0);
}
/***********
* Pie Chart
*/
.nvd3.nv-pie path {
stroke-opacity: 0;
transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
-moz-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
-webkit-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
}
.nvd3.nv-pie .nv-slice text {
stroke: #000;
stroke-width: 0;
}
.nvd3.nv-pie path {
stroke: #fff;
stroke-width: 1px;
stroke-opacity: 1;
}
.nvd3.nv-pie .hover path {
fill-opacity: .7;
}
.nvd3.nv-pie .nv-label {
pointer-events: none;
}
.nvd3.nv-pie .nv-label rect {
fill-opacity: 0;
stroke-opacity: 0;
}
/**********
* Lines
*/
.nvd3 .nv-groups path.nv-line {
fill: none;
stroke-width: 1.5px;
/*
stroke-linecap: round;
shape-rendering: geometricPrecision;
transition: stroke-width 250ms linear;
-moz-transition: stroke-width 250ms linear;
-webkit-transition: stroke-width 250ms linear;
transition-delay: 250ms
-moz-transition-delay: 250ms;
-webkit-transition-delay: 250ms;
*/
}
.nvd3 .nv-groups path.nv-line.nv-thin-line {
stroke-width: 1px;
}
.nvd3 .nv-groups path.nv-area {
stroke: none;
/*
stroke-linecap: round;
shape-rendering: geometricPrecision;
stroke-width: 2.5px;
transition: stroke-width 250ms linear;
-moz-transition: stroke-width 250ms linear;
-webkit-transition: stroke-width 250ms linear;
transition-delay: 250ms
-moz-transition-delay: 250ms;
-webkit-transition-delay: 250ms;
*/
}
.nvd3 .nv-line.hover path {
stroke-width: 6px;
}
/*
.nvd3.scatter .groups .point {
fill-opacity: 0.1;
stroke-opacity: 0.1;
}
*/
.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point {
fill-opacity: 0;
stroke-opacity: 0;
}
.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point {
fill-opacity: .5 !important;
stroke-opacity: .5 !important;
}
.with-transitions .nvd3 .nv-groups .nv-point {
transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
-moz-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
-webkit-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
}
.nvd3.nv-scatter .nv-groups .nv-point.hover,
.nvd3 .nv-groups .nv-point.hover {
stroke-width: 7px;
fill-opacity: .95 !important;
stroke-opacity: .95 !important;
}
.nvd3 .nv-point-paths path {
stroke: #aaa;
stroke-opacity: 0;
fill: #eee;
fill-opacity: 0;
}
.nvd3 .nv-indexLine {
cursor: ew-resize;
}
/**********
* Distribution
*/
.nvd3 .nv-distribution {
pointer-events: none;
}
/**********
* Scatter
*/
/* **Attempting to remove this for useVoronoi(false), need to see if it's required anywhere
.nvd3 .nv-groups .nv-point {
pointer-events: none;
}
*/
.nvd3 .nv-groups .nv-point.hover {
stroke-width: 20px;
stroke-opacity: .5;
}
.nvd3 .nv-scatter .nv-point.hover {
fill-opacity: 1;
}
/*
.nv-group.hover .nv-point {
fill-opacity: 1;
}
*/
/**********
* Stacked Area
*/
.nvd3.nv-stackedarea path.nv-area {
fill-opacity: .7;
/*
stroke-opacity: .65;
fill-opacity: 1;
*/
stroke-opacity: 0;
transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
-moz-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
-webkit-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
/*
transition-delay: 500ms;
-moz-transition-delay: 500ms;
-webkit-transition-delay: 500ms;
*/
}
.nvd3.nv-stackedarea path.nv-area.hover {
fill-opacity: .9;
/*
stroke-opacity: .85;
*/
}
/*
.d3stackedarea .groups path {
stroke-opacity: 0;
}
*/
.nvd3.nv-stackedarea .nv-groups .nv-point {
stroke-opacity: 0;
fill-opacity: 0;
}
/*
.nvd3.nv-stackedarea .nv-groups .nv-point.hover {
stroke-width: 20px;
stroke-opacity: .75;
fill-opacity: 1;
}*/
/**********
* Line Plus Bar
*/
.nvd3.nv-linePlusBar .nv-bar rect {
fill-opacity: .75;
}
.nvd3.nv-linePlusBar .nv-bar rect:hover {
fill-opacity: 1;
}
/**********
* Bullet
*/
.nvd3.nv-bullet { font: 10px sans-serif; }
.nvd3.nv-bullet .nv-measure { fill-opacity: .8; }
.nvd3.nv-bullet .nv-measure:hover { fill-opacity: 1; }
.nvd3.nv-bullet .nv-marker { stroke: #000; stroke-width: 2px; }
.nvd3.nv-bullet .nv-markerTriangle { stroke: #000; fill: #fff; stroke-width: 1.5px; }
.nvd3.nv-bullet .nv-tick line { stroke: #666; stroke-width: .5px; }
.nvd3.nv-bullet .nv-range.nv-s0 { fill: #eee; }
.nvd3.nv-bullet .nv-range.nv-s1 { fill: #ddd; }
.nvd3.nv-bullet .nv-range.nv-s2 { fill: #ccc; }
.nvd3.nv-bullet .nv-title { font-size: 14px; font-weight: bold; }
.nvd3.nv-bullet .nv-subtitle { fill: #999; }
.nvd3.nv-bullet .nv-range {
fill: #bababa;
fill-opacity: .4;
}
.nvd3.nv-bullet .nv-range:hover {
fill-opacity: .7;
}
/**********
* Sparkline
*/
.nvd3.nv-sparkline path {
fill: none;
}
.nvd3.nv-sparklineplus g.nv-hoverValue {
pointer-events: none;
}
.nvd3.nv-sparklineplus .nv-hoverValue line {
stroke: #333;
stroke-width: 1.5px;
}
.nvd3.nv-sparklineplus,
.nvd3.nv-sparklineplus g {
pointer-events: all;
}
.nvd3 .nv-hoverArea {
fill-opacity: 0;
stroke-opacity: 0;
}
.nvd3.nv-sparklineplus .nv-xValue,
.nvd3.nv-sparklineplus .nv-yValue {
/*
stroke: #666;
*/
stroke-width: 0;
font-size: .9em;
font-weight: normal;
}
.nvd3.nv-sparklineplus .nv-yValue {
stroke: #f66;
}
.nvd3.nv-sparklineplus .nv-maxValue {
stroke: #2ca02c;
fill: #2ca02c;
}
.nvd3.nv-sparklineplus .nv-minValue {
stroke: #d62728;
fill: #d62728;
}
.nvd3.nv-sparklineplus .nv-currentValue {
/*
stroke: #444;
fill: #000;
*/
font-weight: bold;
font-size: 1.1em;
}
/**********
* historical stock
*/
.nvd3.nv-ohlcBar .nv-ticks .nv-tick {
stroke-width: 2px;
}
.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover {
stroke-width: 4px;
}
.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive {
stroke: #2ca02c;
}
.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative {
stroke: #d62728;
}
.nvd3.nv-historicalStockChart .nv-axis .nv-axislabel {
font-weight: bold;
}
.nvd3.nv-historicalStockChart .nv-dragTarget {
fill-opacity: 0;
stroke: none;
cursor: move;
}
.nvd3 .nv-brush .extent {
/*
cursor: ew-resize !important;
*/
fill-opacity: 0 !important;
}
.nvd3 .nv-brushBackground rect {
stroke: #000;
stroke-width: .4;
fill: #fff;
fill-opacity: .7;
}
/**********
* Indented Tree
*/
/**
* TODO: the following 3 selectors are based on classes used in the example. I should either make them standard and leave them here, or move to a CSS file not included in the library
*/
.nvd3.nv-indentedtree .name {
margin-left: 5px;
}
.nvd3.nv-indentedtree .clickable {
color: #08C;
cursor: pointer;
}
.nvd3.nv-indentedtree span.clickable:hover {
color: #005580;
text-decoration: underline;
}
.nvd3.nv-indentedtree .nv-childrenCount {
display: inline-block;
margin-left: 5px;
}
.nvd3.nv-indentedtree .nv-treeicon {
cursor: pointer;
/*
cursor: n-resize;
*/
}
.nvd3.nv-indentedtree .nv-treeicon.nv-folded {
cursor: pointer;
/*
cursor: s-resize;
*/
}
/**********
* Parallel Coordinates
*/
.nvd3 .background path {
fill: none;
stroke: #ccc;
stroke-opacity: .4;
shape-rendering: crispEdges;
}
.nvd3 .foreground path {
fill: none;
stroke: steelblue;
stroke-opacity: .7;
}
.nvd3 .brush .extent {
fill-opacity: .3;
stroke: #fff;
shape-rendering: crispEdges;
}
.nvd3 .axis line, .axis path {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.nvd3 .axis text {
text-shadow: 0 1px 0 #fff;
}
/****
Interactive Layer
*/
.nvd3 .nv-interactiveGuideLine {
pointer-events:none;
}
.nvd3 line.nv-guideline {
stroke: #ccc;
}

4938
nv.d3.js

File diff suppressed because it is too large Load Diff

1
nv.d3.min.css vendored

File diff suppressed because one or more lines are too long

5
nv.d3.min.js vendored

File diff suppressed because one or more lines are too long

@ -1,13 +0,0 @@
{
"name": "nvd3",
"version": "0.0.1",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.3.0",
"grunt-contrib-watch": "~0.3.1",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-concat": "~0.2.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-cssmin": "~0.6.2"
}
}

@ -1,15 +1,14 @@
var nv = window.nv || {};
nv.version = '1.1.15b';
nv.version = '0.0.1a';
nv.dev = true //set false when in production
window.nv = nv;
nv.tooltip = nv.tooltip || {}; // For the tooltip system
nv.utils = nv.utils || {}; // Utility subsystem
nv.models = nv.models || {}; //stores all the possible models/components
nv.tooltip = {}; // For the tooltip system
nv.utils = {}; // Utility subsystem
nv.models = {}; //stores all the possible models/components
nv.charts = {}; //stores all the ready to use charts
nv.graphs = []; //stores all the graphs currently on the page
nv.logs = {}; //stores some statistics and potential error messages
@ -35,13 +34,10 @@ if (nv.dev) {
// Public Core NV functions
// Logs all arguments, and returns the last so you can test things in place
// Note: in IE8 console.log is an object not a function, and if modernizr is used
// then calling Function.prototype.bind with with anything other than a function
// causes a TypeError to be thrown.
nv.log = function() {
if (nv.dev && console.log && console.log.apply)
console.log.apply(console, arguments)
else if (nv.dev && typeof console.log == "function" && Function.prototype.bind) {
else if (nv.dev && console.log && Function.prototype.bind) {
var log = Function.prototype.bind.call(console.log, console);
log.apply(console, arguments);
}
@ -67,10 +63,7 @@ nv.render = function render(step) {
nv.render.queue.splice(0, i);
if (nv.render.queue.length) setTimeout(arguments.callee, 0);
else {
nv.dispatch.render_end();
nv.render.active = false;
}
else { nv.render.active = false; nv.dispatch.render_end(); }
}, 0);
};

@ -1,251 +0,0 @@
/* Utility class to handle creation of an interactive layer.
This places a rectangle on top of the chart. When you mouse move over it, it sends a dispatch
containing the X-coordinate. It can also render a vertical line where the mouse is located.
dispatch.elementMousemove is the important event to latch onto. It is fired whenever the mouse moves over
the rectangle. The dispatch is given one object which contains the mouseX/Y location.
It also has 'pointXValue', which is the conversion of mouseX to the x-axis scale.
*/
nv.interactiveGuideline = function() {
"use strict";
var tooltip = nv.models.tooltip();
//Public settings
var width = null
, height = null
//Please pass in the bounding chart's top and left margins
//This is important for calculating the correct mouseX/Y positions.
, margin = {left: 0, top: 0}
, xScale = d3.scale.linear()
, yScale = d3.scale.linear()
, dispatch = d3.dispatch('elementMousemove', 'elementMouseout','elementDblclick')
, showGuideLine = true
, svgContainer = null
//Must pass in the bounding chart's <svg> container.
//The mousemove event is attached to this container.
;
//Private variables
var isMSIE = navigator.userAgent.indexOf("MSIE") !== -1 //Check user-agent for Microsoft Internet Explorer.
;
function layer(selection) {
selection.each(function(data) {
var container = d3.select(this);
var availableWidth = (width || 960), availableHeight = (height || 400);
var wrap = container.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([data]);
var wrapEnter = wrap.enter()
.append("g").attr("class", " nv-wrap nv-interactiveLineLayer");
wrapEnter.append("g").attr("class","nv-interactiveGuideLine");
if (!svgContainer) {
return;
}
function mouseHandler() {
var d3mouse = d3.mouse(this);
var mouseX = d3mouse[0];
var mouseY = d3mouse[1];
var subtractMargin = true;
var mouseOutAnyReason = false;
if (isMSIE) {
/*
D3.js (or maybe SVG.getScreenCTM) has a nasty bug in Internet Explorer 10.
d3.mouse() returns incorrect X,Y mouse coordinates when mouse moving
over a rect in IE 10.
However, d3.event.offsetX/Y also returns the mouse coordinates
relative to the triggering <rect>. So we use offsetX/Y on IE.
*/
mouseX = d3.event.offsetX;
mouseY = d3.event.offsetY;
/*
On IE, if you attach a mouse event listener to the <svg> container,
it will actually trigger it for all the child elements (like <path>, <circle>, etc).
When this happens on IE, the offsetX/Y is set to where ever the child element
is located.
As a result, we do NOT need to subtract margins to figure out the mouse X/Y
position under this scenario. Removing the line below *will* cause
the interactive layer to not work right on IE.
*/
if(d3.event.target.tagName !== "svg")
subtractMargin = false;
if (d3.event.target.className.baseVal.match("nv-legend"))
mouseOutAnyReason = true;
}
if(subtractMargin) {
mouseX -= margin.left;
mouseY -= margin.top;
}
/* If mouseX/Y is outside of the chart's bounds,
trigger a mouseOut event.
*/
if (mouseX < 0 || mouseY < 0
|| mouseX > availableWidth || mouseY > availableHeight
|| (d3.event.relatedTarget && d3.event.relatedTarget.ownerSVGElement === undefined)
|| mouseOutAnyReason
)
{
if (isMSIE) {
if (d3.event.relatedTarget
&& d3.event.relatedTarget.ownerSVGElement === undefined
&& d3.event.relatedTarget.className.match(tooltip.nvPointerEventsClass)) {
return;
}
}
dispatch.elementMouseout({
mouseX: mouseX,
mouseY: mouseY
});
layer.renderGuideLine(null); //hide the guideline
return;
}
var pointXValue = xScale.invert(mouseX);
dispatch.elementMousemove({
mouseX: mouseX,
mouseY: mouseY,
pointXValue: pointXValue
});
//If user double clicks the layer, fire a elementDblclick dispatch.
if (d3.event.type === "dblclick") {
dispatch.elementDblclick({
mouseX: mouseX,
mouseY: mouseY,
pointXValue: pointXValue
});
}
}
svgContainer
.on("mousemove",mouseHandler, true)
.on("mouseout" ,mouseHandler,true)
.on("dblclick" ,mouseHandler)
;
//Draws a vertical guideline at the given X postion.
layer.renderGuideLine = function(x) {
if (!showGuideLine) return;
var line = wrap.select(".nv-interactiveGuideLine")
.selectAll("line")
.data((x != null) ? [nv.utils.NaNtoZero(x)] : [], String);
line.enter()
.append("line")
.attr("class", "nv-guideline")
.attr("x1", function(d) { return d;})
.attr("x2", function(d) { return d;})
.attr("y1", availableHeight)
.attr("y2",0)
;
line.exit().remove();
}
});
}
layer.dispatch = dispatch;
layer.tooltip = tooltip;
layer.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
return layer;
};
layer.width = function(_) {
if (!arguments.length) return width;
width = _;
return layer;
};
layer.height = function(_) {
if (!arguments.length) return height;
height = _;
return layer;
};
layer.xScale = function(_) {
if (!arguments.length) return xScale;
xScale = _;
return layer;
};
layer.showGuideLine = function(_) {
if (!arguments.length) return showGuideLine;
showGuideLine = _;
return layer;
};
layer.svgContainer = function(_) {
if (!arguments.length) return svgContainer;
svgContainer = _;
return layer;
};
return layer;
};
/* Utility class that uses d3.bisect to find the index in a given array, where a search value can be inserted.
This is different from normal bisectLeft; this function finds the nearest index to insert the search value.
For instance, lets say your array is [1,2,3,5,10,30], and you search for 28.
Normal d3.bisectLeft will return 4, because 28 is inserted after the number 10. But interactiveBisect will return 5
because 28 is closer to 30 than 10.
Unit tests can be found in: interactiveBisectTest.html
Has the following known issues:
* Will not work if the data points move backwards (ie, 10,9,8,7, etc) or if the data points are in random order.
* Won't work if there are duplicate x coordinate values.
*/
nv.interactiveBisect = function (values, searchVal, xAccessor) {
"use strict";
if (! values instanceof Array) return null;
if (typeof xAccessor !== 'function') xAccessor = function(d,i) { return d.x;}
var bisect = d3.bisector(xAccessor).left;
var index = d3.max([0, bisect(values,searchVal) - 1]);
var currentValue = xAccessor(values[index], index);
if (typeof currentValue === 'undefined') currentValue = index;
if (currentValue === searchVal) return index; //found exact match
var nextIndex = d3.min([index+1, values.length - 1]);
var nextValue = xAccessor(values[nextIndex], nextIndex);
if (typeof nextValue === 'undefined') nextValue = nextIndex;
if (Math.abs(nextValue - searchVal) >= Math.abs(currentValue - searchVal))
return index;
else
return nextIndex
};
/*
Returns the index in the array "values" that is closest to searchVal.
Only returns an index if searchVal is within some "threshold".
Otherwise, returns null.
*/
nv.nearestValueIndex = function (values, searchVal, threshold) {
"use strict";
var yDistMax = Infinity, indexToHighlight = null;
values.forEach(function(d,i) {
var delta = Math.abs(searchVal - d);
if ( delta <= yDistMax && delta < threshold) {
yDistMax = delta;
indexToHighlight = i;
}
});
return indexToHighlight;
};

@ -1,5 +1,5 @@
nv.models.axis = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -19,7 +19,6 @@ nv.models.axis = function() {
, staggerLabels = false
, isOrdinal = false
, ticks = null
, axisLabelDistance = 12 //The larger this number is, the closer the axis label is to the axis.
;
axis
@ -65,7 +64,8 @@ nv.models.axis = function() {
//TODO: consider calculating width/height based on whether or not label is added, for reference in charts using this component
g.transition().call(axis);
d3.transition(g)
.call(axis);
scale0 = scale0 || axis.scale();
@ -95,14 +95,14 @@ nv.models.axis = function() {
return 'translate(' + scale(d) + ',0)'
})
.select('text')
.attr('dy', '-0.5em')
.attr('dy', '0em')
.attr('y', -axis.tickPadding())
.attr('text-anchor', 'middle')
.text(function(d,i) {
var v = fmt(d);
return ('' + v).match('NaN') ? '' : v;
});
axisMaxMin.transition()
d3.transition(axisMaxMin)
.attr('transform', function(d,i) {
return 'translate(' + scale.range()[i] + ',0)'
});
@ -124,7 +124,7 @@ nv.models.axis = function() {
//Rotate all xTicks
xTicks
.attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' })
.style('text-anchor', rotateLabels%360 > 0 ? 'start' : 'end');
.attr('text-anchor', rotateLabels%360 > 0 ? 'start' : 'end');
}
axisLabel.enter().append('text').attr('class', 'nv-axislabel');
var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0]));
@ -147,12 +147,12 @@ nv.models.axis = function() {
.attr('dy', '.71em')
.attr('y', axis.tickPadding())
.attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' })
.style('text-anchor', rotateLabels ? (rotateLabels%360 > 0 ? 'start' : 'end') : 'middle')
.attr('text-anchor', rotateLabels ? (rotateLabels%360 > 0 ? 'start' : 'end') : 'middle')
.text(function(d,i) {
var v = fmt(d);
return ('' + v).match('NaN') ? '' : v;
});
axisMaxMin.transition()
d3.transition(axisMaxMin)
.attr('transform', function(d,i) {
//return 'translate(' + scale.range()[i] + ',0)'
//return 'translate(' + scale(d) + ',0)'
@ -167,7 +167,7 @@ nv.models.axis = function() {
case 'right':
axisLabel.enter().append('text').attr('class', 'nv-axislabel');
axisLabel
.style('text-anchor', rotateYLabel ? 'middle' : 'begin')
.attr('text-anchor', rotateYLabel ? 'middle' : 'begin')
.attr('transform', rotateYLabel ? 'rotate(90)' : '')
.attr('y', rotateYLabel ? (-Math.max(margin.right,width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart
.attr('x', rotateYLabel ? (scale.range()[0] / 2) : axis.tickPadding());
@ -185,12 +185,12 @@ nv.models.axis = function() {
.attr('dy', '.32em')
.attr('y', 0)
.attr('x', axis.tickPadding())
.style('text-anchor', 'start')
.attr('text-anchor', 'start')
.text(function(d,i) {
var v = fmt(d);
return ('' + v).match('NaN') ? '' : v;
});
axisMaxMin.transition()
d3.transition(axisMaxMin)
.attr('transform', function(d,i) {
return 'translate(0,' + scale.range()[i] + ')'
})
@ -209,9 +209,9 @@ nv.models.axis = function() {
*/
axisLabel.enter().append('text').attr('class', 'nv-axislabel');
axisLabel
.style('text-anchor', rotateYLabel ? 'middle' : 'end')
.attr('text-anchor', rotateYLabel ? 'middle' : 'end')
.attr('transform', rotateYLabel ? 'rotate(-90)' : '')
.attr('y', rotateYLabel ? (-Math.max(margin.left,width) + axisLabelDistance) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart
.attr('y', rotateYLabel ? (-Math.max(margin.left,width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart
.attr('x', rotateYLabel ? (-scale.range()[0] / 2) : -axis.tickPadding());
if (showMaxMin) {
var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin')
@ -232,7 +232,7 @@ nv.models.axis = function() {
var v = fmt(d);
return ('' + v).match('NaN') ? '' : v;
});
axisMaxMin.transition()
d3.transition(axisMaxMin)
.attr('transform', function(d,i) {
return 'translate(0,' + scale.range()[i] + ')'
})
@ -253,7 +253,7 @@ nv.models.axis = function() {
if (scale(d) < scale.range()[1] + 10 || scale(d) > scale.range()[0] - 10) { // 10 is assuming text height is 16... if d is 0, leave it!
if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL
d3.select(this).attr('opacity', 0);
d3.select(this).select('text').attr('opacity', 0); // Don't remove the ZERO line!!
}
});
@ -295,8 +295,8 @@ nv.models.axis = function() {
//highlight zero line ... Maybe should not be an option and should just be in CSS?
if (highlightZero)
g.selectAll('.tick')
.filter(function(d) { return !parseFloat(Math.round(d.__data__*100000)/1000000) && (d.__data__ !== undefined) }) //this is because sometimes the 0 tick is a very small fraction, TODO: think of cleaner technique
g.selectAll('line.tick')
.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);
//store old scales for use in transitions on update
@ -318,8 +318,6 @@ nv.models.axis = function() {
d3.rebind(chart, axis, 'orient', 'tickValues', 'tickSubdivide', 'tickSize', 'tickPadding', 'tickFormat');
d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands'); //these are also accessible by chart.scale(), but added common ones directly for ease of use
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if(!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
@ -392,11 +390,6 @@ nv.models.axis = function() {
return chart;
};
chart.axisLabelDistance = function(_) {
if (!arguments.length) return axisLabelDistance;
axisLabelDistance = _;
return chart;
};
//============================================================

@ -1,6 +1,6 @@
nv.models.chartName = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -68,8 +68,6 @@ nv.models.chartName = function() {
chart.dispatch = dispatch;
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;

@ -4,7 +4,7 @@
// http://projects.instantcognition.com/protovis/bulletchart/
nv.models.bullet = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -15,9 +15,6 @@ nv.models.bullet = function() {
, ranges = function(d) { return d.ranges }
, markers = function(d) { return d.markers }
, measures = function(d) { return d.measures }
, rangeLabels = function(d) { return d.rangeLabels ? d.rangeLabels : [] }
, markerLabels = function(d) { return d.markerLabels ? d.markerLabels : [] }
, measureLabels = function(d) { return d.measureLabels ? d.measureLabels : [] }
, forceX = [0] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.)
, width = 380
, height = 30
@ -37,10 +34,7 @@ nv.models.bullet = function() {
var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
markerz = markers.call(this, d, i).slice().sort(d3.descending),
measurez = measures.call(this, d, i).slice().sort(d3.descending),
rangeLabelz = rangeLabels.call(this, d, i).slice(),
markerLabelz = markerLabels.call(this, d, i).slice(),
measureLabelz = measureLabels.call(this, d, i).slice();
measurez = measures.call(this, d, i).slice().sort(d3.descending);
//------------------------------------------------------------
@ -147,14 +141,14 @@ nv.models.bullet = function() {
.on('mouseover', function() {
dispatch.elementMouseover({
value: measurez[0],
label: measureLabelz[0] || 'Current',
label: 'Current',
pos: [x1(measurez[0]), availableHeight/2]
})
})
.on('mouseout', function() {
dispatch.elementMouseout({
value: measurez[0],
label: measureLabelz[0] || 'Current'
label: 'Current'
})
})
@ -166,14 +160,14 @@ nv.models.bullet = function() {
.on('mouseover', function() {
dispatch.elementMouseover({
value: markerz[0],
label: markerLabelz[0] || 'Previous',
label: 'Previous',
pos: [x1(markerz[0]), availableHeight/2]
})
})
.on('mouseout', function() {
dispatch.elementMouseout({
value: markerz[0],
label: markerLabelz[0] || 'Previous'
label: 'Previous'
})
});
} else {
@ -183,7 +177,7 @@ nv.models.bullet = function() {
wrap.selectAll('.nv-range')
.on('mouseover', function(d,i) {
var label = rangeLabelz[i] || (!i ? "Maximum" : i == 1 ? "Mean" : "Minimum");
var label = !i ? "Maximum" : i == 1 ? "Mean" : "Minimum";
dispatch.elementMouseover({
value: d,
@ -192,7 +186,7 @@ nv.models.bullet = function() {
})
})
.on('mouseout', function(d,i) {
var label = rangeLabelz[i] || (!i ? "Maximum" : i == 1 ? "Mean" : "Minimum");
var label = !i ? "Maximum" : i == 1 ? "Mean" : "Minimum";
dispatch.elementMouseout({
value: d,
@ -306,8 +300,6 @@ nv.models.bullet = function() {
chart.dispatch = dispatch;
chart.options = nv.utils.optionsFunc.bind(chart);
// left, right, top, bottom
chart.orient = function(_) {
if (!arguments.length) return orient;

@ -3,7 +3,7 @@
// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
// http://projects.instantcognition.com/protovis/bulletchart/
nv.models.bulletChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -258,8 +258,6 @@ nv.models.bulletChart = function() {
d3.rebind(chart, bullet, 'color');
chart.options = nv.utils.optionsFunc.bind(chart);
// left, right, top, bottom
chart.orient = function(x) {
if (!arguments.length) return orient;

@ -1,6 +1,6 @@
nv.models.cumulativeLineChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -10,7 +10,6 @@ nv.models.cumulativeLineChart = function() {
, yAxis = nv.models.axis()
, legend = nv.models.legend()
, controls = nv.models.legend()
, interactiveLayer = nv.interactiveGuideline()
;
var margin = {top: 30, right: 30, bottom: 50, left: 60}
@ -18,12 +17,8 @@ nv.models.cumulativeLineChart = function() {
, width = null
, height = null
, showLegend = true
, showXAxis = true
, showYAxis = true
, rightAlignYAxis = false
, tooltips = true
, showControls = true
, useInteractiveGuideline = false
, rescaleY = true
, tooltip = function(key, x, y, e, graph) {
return '<h3>' + key + '</h3>' +
@ -37,8 +32,6 @@ nv.models.cumulativeLineChart = function() {
, noData = 'No Data Available.'
, average = function(d) { return d.average }
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
, transitionDuration = 250
, noErrorCheck = false //if set to TRUE, will bypass an error check in the indexify function.
;
xAxis
@ -46,11 +39,11 @@ nv.models.cumulativeLineChart = function() {
.tickPadding(7)
;
yAxis
.orient((rightAlignYAxis) ? 'right' : 'left')
.orient('left')
;
//============================================================
controls.updateState(false);
//============================================================
// Private Variables
@ -70,8 +63,36 @@ nv.models.cumulativeLineChart = function() {
nv.tooltip.show([left, top], content, null, null, offsetElement);
};
/*
//Moved to see if we can get better behavior to fix issue #315
var indexDrag = d3.behavior.drag()
.on('dragstart', dragStart)
.on('drag', dragMove)
.on('dragend', dragEnd);
function dragStart(d,i) {
d3.select(chart.container)
.style('cursor', 'ew-resize');
}
function dragMove(d,i) {
d.x += d3.event.dx;
d.i = Math.round(dx.invert(d.x));
d3.select(this).attr('transform', 'translate(' + dx(d.i) + ',0)');
chart.update();
}
function dragEnd(d,i) {
d3.select(chart.container)
.style('cursor', 'auto');
chart.update();
}
*/
//============================================================
function chart(selection) {
selection.each(function(data) {
var container = d3.select(this).classed('nv-chart-' + id, true),
@ -83,7 +104,7 @@ nv.models.cumulativeLineChart = function() {
- margin.top - margin.bottom;
chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
chart.update = function() { chart(selection) };
chart.container = this;
//set state.disabled
@ -126,6 +147,9 @@ nv.models.cumulativeLineChart = function() {
dispatch.stateChange(state);
}
//------------------------------------------------------------
// Display No Data message if there's nothing to show.
@ -195,20 +219,21 @@ nv.models.cumulativeLineChart = function() {
//------------------------------------------------------------
// Setup containers and skeleton of chart
var interactivePointerEvents = (useInteractiveGuideline) ? "none" : "all";
var wrap = container.selectAll('g.nv-wrap.nv-cumulativeLine').data([data]);
var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-cumulativeLine').append('g');
var g = wrap.select('g');
gEnter.append('g').attr('class', 'nv-interactive');
gEnter.append('g').attr('class', 'nv-x nv-axis').style("pointer-events","none");
gEnter.append('g').attr('class', 'nv-x nv-axis');
gEnter.append('g').attr('class', 'nv-y nv-axis');
gEnter.append('g').attr('class', 'nv-background');
gEnter.append('g').attr('class', 'nv-linesWrap').style("pointer-events",interactivePointerEvents);
gEnter.append('g').attr('class', 'nv-avgLinesWrap').style("pointer-events","none");
gEnter.append('g').attr('class', 'nv-linesWrap');
gEnter.append('g').attr('class', 'nv-avgLinesWrap');
gEnter.append('g').attr('class', 'nv-legendWrap');
gEnter.append('g').attr('class', 'nv-controlsWrap');
//------------------------------------------------------------
//------------------------------------------------------------
// Legend
@ -241,13 +266,7 @@ nv.models.cumulativeLineChart = function() {
{ key: 'Re-scale y-axis', disabled: !rescaleY }
];
controls
.width(140)
.color(['#444', '#444', '#444'])
.rightAlign(false)
.margin({top: 5, right: 0, bottom: 5, left: 20})
;
controls.width(140).color(['#444', '#444', '#444']);
g.select('.nv-controlsWrap')
.datum(controlsData)
.attr('transform', 'translate(0,' + (-margin.top) +')')
@ -259,10 +278,6 @@ nv.models.cumulativeLineChart = function() {
wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
if (rightAlignYAxis) {
g.select(".nv-y.nv-axis")
.attr("transform", "translate(" + availableWidth + ",0)");
}
// Show error if series goes below 100%
var tempDisabled = data.filter(function(d) { return d.tempDisabled });
@ -279,18 +294,6 @@ nv.models.cumulativeLineChart = function() {
//------------------------------------------------------------
// Main Chart Component(s)
//------------------------------------------------------------
//Set up interactive layer
if (useInteractiveGuideline) {
interactiveLayer
.width(availableWidth)
.height(availableHeight)
.margin({left:margin.left,top:margin.top})
.svgContainer(container)
.xScale(x);
wrap.select(".nv-interactive").call(interactiveLayer);
}
gEnter.select('.nv-background')
.append('rect');
@ -329,14 +332,6 @@ nv.models.cumulativeLineChart = function() {
var avgLines = g.select(".nv-avgLinesWrap").selectAll("line")
.data(avgLineData, function(d) { return d.key; });
var getAvgLineY = function(d) {
//If average lines go off the svg element, clamp them to the svg bounds.
var yVal = y(average(d));
if (yVal < 0) return 0;
if (yVal > availableHeight) return availableHeight;
return yVal;
};
avgLines.enter()
.append('line')
.style('stroke-width',2)
@ -346,20 +341,14 @@ nv.models.cumulativeLineChart = function() {
})
.attr('x1',0)
.attr('x2',availableWidth)
.attr('y1', getAvgLineY)
.attr('y2', getAvgLineY);
.attr('y1', function(d) { return y(average(d)); })
.attr('y2', function(d) { return y(average(d)); });
avgLines
.style('stroke-opacity',function(d){
//If average lines go offscreen, make them transparent
var yVal = y(average(d));
if (yVal < 0 || yVal > availableHeight) return 0;
return 1;
})
.attr('x1',0)
.attr('x2',availableWidth)
.attr('y1', getAvgLineY)
.attr('y2', getAvgLineY);
.attr('y1', function(d) { return y(average(d)); })
.attr('y2', function(d) { return y(average(d)); });
avgLines.exit().remove();
@ -372,7 +361,6 @@ nv.models.cumulativeLineChart = function() {
.attr('x', -2)
.attr('fill', 'red')
.attr('fill-opacity', .5)
.style("pointer-events","all")
.call(indexDrag)
indexLine
@ -385,29 +373,26 @@ nv.models.cumulativeLineChart = function() {
//------------------------------------------------------------
// Setup Axes
if (showXAxis) {
xAxis
.scale(x)
//Suggest how many ticks based on the chart width and D3 should listen (70 is the optimal number for MM/DD/YY dates)
.ticks( Math.min(data[0].values.length,availableWidth/70) )
.tickSize(-availableHeight, 0);
g.select('.nv-x.nv-axis')
.attr('transform', 'translate(0,' + y.range()[0] + ')');
d3.transition(g.select('.nv-x.nv-axis'))
.call(xAxis);
}
xAxis
.scale(x)
//Suggest how many ticks based on the chart width and D3 should listen (70 is the optimal number for MM/DD/YY dates)
.ticks( Math.min(data[0].values.length,availableWidth/70) )
.tickSize(-availableHeight, 0);
g.select('.nv-x.nv-axis')
.attr('transform', 'translate(0,' + y.range()[0] + ')');
d3.transition(g.select('.nv-x.nv-axis'))
.call(xAxis);
if (showYAxis) {
yAxis
.scale(y)
.ticks( availableHeight / 36 )
.tickSize( -availableWidth, 0);
d3.transition(g.select('.nv-y.nv-axis'))
.call(yAxis);
}
yAxis
.scale(y)
.ticks( availableHeight / 36 )
.tickSize( -availableWidth, 0);
d3.transition(g.select('.nv-y.nv-axis'))
.call(yAxis);
//------------------------------------------------------------
@ -420,12 +405,7 @@ nv.models.cumulativeLineChart = function() {
indexLine
.data([index]);
//When dragging the index line, turn off line transitions.
// Then turn them back on when done dragging.
var oldDuration = chart.transitionDuration();
chart.transitionDuration(0);
chart.update();
chart.transitionDuration(oldDuration);
}
g.select('.nv-background rect')
@ -451,79 +431,48 @@ nv.models.cumulativeLineChart = function() {
updateZero();
});
controls.dispatch.on('legendClick', function(d,i) {
controls.dispatch.on('legendClick', function(d,i) {
d.disabled = !d.disabled;
rescaleY = !d.disabled;
state.rescaleY = rescaleY;
dispatch.stateChange(state);
chart.update();
//selection.transition().call(chart);
selection.call(chart);
});
legend.dispatch.on('stateChange', function(newState) {
state.disabled = newState.disabled;
dispatch.stateChange(state);
chart.update();
});
legend.dispatch.on('legendClick', function(d,i) {
d.disabled = !d.disabled;
interactiveLayer.dispatch.on('elementMousemove', function(e) {
lines.clearHighlights();
var singlePoint, pointIndex, pointXLocation, allData = [];
data
.filter(function(series, i) {
series.seriesIndex = i;
return !series.disabled;
})
.forEach(function(series,i) {
pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x());
lines.highlightPoint(i, pointIndex, true);
var point = series.values[pointIndex];
if (typeof point === 'undefined') return;
if (typeof singlePoint === 'undefined') singlePoint = point;
if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex));
allData.push({
key: series.key,
value: chart.y()(point, pointIndex),
color: color(series,series.seriesIndex)
});
if (!data.filter(function(d) { return !d.disabled }).length) {
data.map(function(d) {
d.disabled = false;
wrap.selectAll('.nv-series').classed('disabled', false);
return d;
});
}
//Highlight the tooltip entry based on which point the mouse is closest to.
if (allData.length > 2) {
var yValue = chart.yScale().invert(e.mouseY);
var domainExtent = Math.abs(chart.yScale().domain()[0] - chart.yScale().domain()[1]);
var threshold = 0.03 * domainExtent;
var indexToHighlight = nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold);
if (indexToHighlight !== null)
allData[indexToHighlight].highlight = true;
}
var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex), pointIndex);
interactiveLayer.tooltip
.position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
.chartContainer(that.parentNode)
.enabled(tooltips)
.valueFormatter(function(d,i) {
return yAxis.tickFormat()(d);
})
.data(
{
value: xValue,
series: allData
}
)();
interactiveLayer.renderGuideLine(pointXLocation);
state.disabled = data.map(function(d) { return !!d.disabled });
dispatch.stateChange(state);
//selection.transition().call(chart);
selection.call(chart);
});
/*
//
legend.dispatch.on('legendMouseover', function(d, i) {
d.hover = true;
selection.transition().call(chart)
});
interactiveLayer.dispatch.on("elementMouseout",function(e) {
dispatch.tooltipHide();
lines.clearHighlights();
legend.dispatch.on('legendMouseout', function(d, i) {
d.hover = false;
selection.transition().call(chart)
});
*/
dispatch.on('tooltipShow', function(e) {
if (tooltips) showTooltip(e, that.parentNode);
@ -557,7 +506,7 @@ nv.models.cumulativeLineChart = function() {
rescaleY = e.rescaleY;
}
chart.update();
selection.call(chart);
});
//============================================================
@ -598,11 +547,8 @@ nv.models.cumulativeLineChart = function() {
chart.legend = legend;
chart.xAxis = xAxis;
chart.yAxis = yAxis;
chart.interactiveLayer = interactiveLayer;
d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'xScale','yScale', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi','useVoronoi', 'id');
chart.options = nv.utils.optionsFunc.bind(chart);
d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
chart.margin = function(_) {
if (!arguments.length) return margin;
@ -634,8 +580,8 @@ nv.models.cumulativeLineChart = function() {
chart.rescaleY = function(_) {
if (!arguments.length) return rescaleY;
rescaleY = _;
return chart;
rescaleY = _
return rescaleY;
};
chart.showControls = function(_) {
@ -644,41 +590,12 @@ nv.models.cumulativeLineChart = function() {
return chart;
};
chart.useInteractiveGuideline = function(_) {
if(!arguments.length) return useInteractiveGuideline;
useInteractiveGuideline = _;
if (_ === true) {
chart.interactive(false);
chart.useVoronoi(false);
}
return chart;
};
chart.showLegend = function(_) {
if (!arguments.length) return showLegend;
showLegend = _;
return chart;
};
chart.showXAxis = function(_) {
if (!arguments.length) return showXAxis;
showXAxis = _;
return chart;
};
chart.showYAxis = function(_) {
if (!arguments.length) return showYAxis;
showYAxis = _;
return chart;
};
chart.rightAlignYAxis = function(_) {
if(!arguments.length) return rightAlignYAxis;
rightAlignYAxis = _;
yAxis.orient( (_) ? 'right' : 'left');
return chart;
};
chart.tooltips = function(_) {
if (!arguments.length) return tooltips;
tooltips = _;
@ -715,18 +632,6 @@ nv.models.cumulativeLineChart = function() {
return chart;
};
chart.transitionDuration = function(_) {
if (!arguments.length) return transitionDuration;
transitionDuration = _;
return chart;
};
chart.noErrorCheck = function(_) {
if (!arguments.length) return noErrorCheck;
noErrorCheck = _;
return chart;
};
//============================================================
@ -740,16 +645,11 @@ nv.models.cumulativeLineChart = function() {
if (!line.values) {
return line;
}
var indexValue = line.values[idx];
if (indexValue == null) {
return line;
}
var v = lines.y()(indexValue, idx);
var v = lines.y()(line.values[idx], idx);
//TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue
if (v < -.95 && !noErrorCheck) {
if (v < -.95) {
//if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically correct till it hits 100)
line.tempDisabled = true;
return line;
}

@ -1,6 +1,6 @@
//TODO: consider deprecating by adding necessary features to multiBar model
nv.models.discreteBar = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -19,8 +19,6 @@ nv.models.discreteBar = function() {
, valueFormat = d3.format(',.2f')
, xDomain
, yDomain
, xRange
, yRange
, dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
, rectClass = 'discreteBar'
;
@ -45,10 +43,12 @@ nv.models.discreteBar = function() {
//add series index to each data point for reference
data.forEach(function(series, i) {
series.values.forEach(function(point) {
data = data.map(function(series, i) {
series.values = series.values.map(function(point) {
point.series = i;
return point;
});
return series;
});
@ -64,14 +64,14 @@ nv.models.discreteBar = function() {
});
x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
.rangeBands(xRange || [0, availableWidth], .1);
.rangeBands([0, availableWidth], .1);
y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y }).concat(forceY)));
// If showValues, pad the Y axis range to account for label height
if (showValues) y.range(yRange || [availableHeight - (y.domain()[0] < 0 ? 12 : 0), y.domain()[1] > 0 ? 12 : 0]);
else y.range(yRange || [availableHeight, 0]);
if (showValues) y.range([availableHeight - (y.domain()[0] < 0 ? 12 : 0), y.domain()[1] > 0 ? 12 : 0]);
else y.range([availableHeight, 0]);
//store old scales if they exist
x0 = x0 || x;
@ -102,16 +102,14 @@ nv.models.discreteBar = function() {
groups.enter().append('g')
.style('stroke-opacity', 1e-6)
.style('fill-opacity', 1e-6);
groups.exit()
.transition()
d3.transition(groups.exit())
.style('stroke-opacity', 1e-6)
.style('fill-opacity', 1e-6)
.remove();
groups
.attr('class', function(d,i) { return 'nv-group nv-series-' + i })
.classed('hover', function(d) { return d.hover });
groups
.transition()
d3.transition(groups)
.style('stroke-opacity', 1)
.style('fill-opacity', .75);
@ -124,7 +122,7 @@ nv.models.discreteBar = function() {
var barsEnter = bars.enter().append('g')
.attr('transform', function(d,i,j) {
return 'translate(' + (x(getX(d,i)) + x.rangeBand() * .05 ) + ', ' + y(0) + ')'
return 'translate(' + (x(getX(d,i)) + x.rangeBand() * .05 ) + ', ' + y(0) + ')'
})
.on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here
d3.select(this).classed('hover', true);
@ -181,15 +179,10 @@ nv.models.discreteBar = function() {
if (showValues) {
barsEnter.append('text')
.attr('text-anchor', 'middle')
;
bars.select('text')
.text(function(d,i) { return valueFormat(getY(d,i)) })
.transition()
.attr('x', x.rangeBand() * .9 / 2)
.attr('y', function(d,i) { return getY(d,i) < 0 ? y(getY(d,i)) - y(0) + 12 : -4 })
;
.text(function(d,i) { return valueFormat(getY(d,i)) });
} else {
bars.selectAll('text').remove();
}
@ -200,9 +193,8 @@ nv.models.discreteBar = function() {
.style('stroke', function(d,i) { return d.color || color(d,i) })
.select('rect')
.attr('class', rectClass)
.transition()
.attr('width', x.rangeBand() * .9 / data.length);
bars.transition()
d3.transition(bars)
//.delay(function(d,i) { return i * 1200 / data[0].values.length })
.attr('transform', function(d,i) {
var left = x(getX(d,i)) + x.rangeBand() * .05,
@ -216,7 +208,7 @@ nv.models.discreteBar = function() {
})
.select('rect')
.attr('height', function(d,i) {
return Math.max(Math.abs(y(getY(d,i)) - y((yDomain && yDomain[0]) || 0)) || 1)
return Math.max(Math.abs(y(getY(d,i)) - y(0)) || 1)
});
@ -236,8 +228,6 @@ nv.models.discreteBar = function() {
chart.dispatch = dispatch;
chart.options = nv.utils.optionsFunc.bind(chart);
chart.x = function(_) {
if (!arguments.length) return getX;
getX = _;
@ -295,18 +285,6 @@ nv.models.discreteBar = function() {
return chart;
};
chart.xRange = function(_) {
if (!arguments.length) return xRange;
xRange = _;
return chart;
};
chart.yRange = function(_) {
if (!arguments.length) return yRange;
yRange = _;
return chart;
};
chart.forceY = function(_) {
if (!arguments.length) return forceY;
forceY = _;
@ -341,7 +319,7 @@ nv.models.discreteBar = function() {
if (!arguments.length) return rectClass;
rectClass = _;
return chart;
};
}
//============================================================

@ -1,6 +1,6 @@
nv.models.discreteBarChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -14,9 +14,6 @@ nv.models.discreteBarChart = function() {
, width = null
, height = null
, color = nv.utils.getColor()
, showXAxis = true
, showYAxis = true
, rightAlignYAxis = false
, staggerLabels = false
, tooltips = true
, tooltip = function(key, x, y, e, graph) {
@ -27,7 +24,6 @@ nv.models.discreteBarChart = function() {
, y
, noData = "No Data Available."
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'beforeUpdate')
, transitionDuration = 250
;
xAxis
@ -37,7 +33,7 @@ nv.models.discreteBarChart = function() {
.tickFormat(function(d) { return d })
;
yAxis
.orient((rightAlignYAxis) ? 'right' : 'left')
.orient('left')
.tickFormat(d3.format(',.1f'))
;
@ -72,10 +68,7 @@ nv.models.discreteBarChart = function() {
- margin.top - margin.bottom;
chart.update = function() {
dispatch.beforeUpdate();
container.transition().duration(transitionDuration).call(chart);
};
chart.update = function() { dispatch.beforeUpdate(); selection.transition().call(chart); };
chart.container = this;
@ -107,7 +100,7 @@ nv.models.discreteBarChart = function() {
// Setup Scales
x = discretebar.xScale();
y = discretebar.yScale().clamp(true);
y = discretebar.yScale();
//------------------------------------------------------------
@ -121,19 +114,11 @@ nv.models.discreteBarChart = function() {
var g = wrap.select('g');
gEnter.append('g').attr('class', 'nv-x nv-axis');
gEnter.append('g').attr('class', 'nv-y nv-axis')
.append('g').attr('class', 'nv-zeroLine')
.append('line');
gEnter.append('g').attr('class', 'nv-y nv-axis');
gEnter.append('g').attr('class', 'nv-barsWrap');
g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
if (rightAlignYAxis) {
g.select(".nv-y.nv-axis")
.attr("transform", "translate(" + availableWidth + ",0)");
}
//------------------------------------------------------------
@ -148,7 +133,7 @@ nv.models.discreteBarChart = function() {
var barsWrap = g.select('.nv-barsWrap')
.datum(data.filter(function(d) { return !d.disabled }))
barsWrap.transition().call(discretebar);
d3.transition(barsWrap).call(discretebar);
//------------------------------------------------------------
@ -167,45 +152,33 @@ nv.models.discreteBarChart = function() {
//------------------------------------------------------------
// Setup Axes
if (showXAxis) {
xAxis
.scale(x)
.ticks( availableWidth / 100 )
.tickSize(-availableHeight, 0);
xAxis
.scale(x)
.ticks( availableWidth / 100 )
.tickSize(-availableHeight, 0);
g.select('.nv-x.nv-axis')
.attr('transform', 'translate(0,' + (y.range()[0] + ((discretebar.showValues() && y.domain()[0] < 0) ? 16 : 0)) + ')');
//d3.transition(g.select('.nv-x.nv-axis'))
g.select('.nv-x.nv-axis').transition()
.call(xAxis);
g.select('.nv-x.nv-axis')
.attr('transform', 'translate(0,' + (y.range()[0] + ((discretebar.showValues() && y.domain()[0] < 0) ? 16 : 0)) + ')');
//d3.transition(g.select('.nv-x.nv-axis'))
g.select('.nv-x.nv-axis').transition().duration(0)
.call(xAxis);
var xTicks = g.select('.nv-x.nv-axis').selectAll('g');
var xTicks = g.select('.nv-x.nv-axis').selectAll('g');
if (staggerLabels) {
xTicks
.selectAll('text')
.attr('transform', function(d,i,j) { return 'translate(0,' + (j % 2 == 0 ? '5' : '17') + ')' })
}
if (staggerLabels) {
xTicks
.selectAll('text')
.attr('transform', function(d,i,j) { return 'translate(0,' + (j % 2 == 0 ? '5' : '17') + ')' })
}
if (showYAxis) {
yAxis
.scale(y)
.ticks( availableHeight / 36 )
.tickSize( -availableWidth, 0);
g.select('.nv-y.nv-axis').transition()
.call(yAxis);
}
yAxis
.scale(y)
.ticks( availableHeight / 36 )
.tickSize( -availableWidth, 0);
// Zero line
g.select(".nv-zeroLine line")
.attr("x1",0)
.attr("x2",availableWidth)
.attr("y1", y(0))
.attr("y2", y(0))
;
d3.transition(g.select('.nv-y.nv-axis'))
.call(yAxis);
//------------------------------------------------------------
@ -256,10 +229,8 @@ nv.models.discreteBarChart = function() {
chart.xAxis = xAxis;
chart.yAxis = yAxis;
d3.rebind(chart, discretebar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'id', 'showValues', 'valueFormat');
d3.rebind(chart, discretebar, 'x', 'y', 'xDomain', 'yDomain', 'forceX', 'forceY', 'id', 'showValues', 'valueFormat');
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
@ -288,25 +259,6 @@ nv.models.discreteBarChart = function() {
return chart;
};
chart.showXAxis = function(_) {
if (!arguments.length) return showXAxis;
showXAxis = _;
return chart;
};
chart.showYAxis = function(_) {
if (!arguments.length) return showYAxis;
showYAxis = _;
return chart;
};
chart.rightAlignYAxis = function(_) {
if(!arguments.length) return rightAlignYAxis;
rightAlignYAxis = _;
yAxis.orient( (_) ? 'right' : 'left');
return chart;
};
chart.staggerLabels = function(_) {
if (!arguments.length) return staggerLabels;
staggerLabels = _;
@ -331,12 +283,6 @@ nv.models.discreteBarChart = function() {
return chart;
};
chart.transitionDuration = function(_) {
if (!arguments.length) return transitionDuration;
transitionDuration = _;
return chart;
};
//============================================================

@ -1,6 +1,6 @@
nv.models.distribution = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -68,8 +68,7 @@ nv.models.distribution = function() {
dist.enter().append('line')
.attr(axis + '1', function(d,i) { return scale0(getData(d,i)) })
.attr(axis + '2', function(d,i) { return scale0(getData(d,i)) })
distWrap.exit().selectAll('line.nv-dist' + axis)
.transition()
d3.transition(distWrap.exit().selectAll('line.nv-dist' + axis))
.attr(axis + '1', function(d,i) { return scale(getData(d,i)) })
.attr(axis + '2', function(d,i) { return scale(getData(d,i)) })
.style('stroke-opacity', 0)
@ -78,8 +77,7 @@ nv.models.distribution = function() {
.attr('class', function(d,i) { return 'nv-dist' + axis + ' nv-dist' + axis + '-' + i })
.attr(naxis + '1', 0)
.attr(naxis + '2', size);
dist
.transition()
d3.transition(dist)
.attr(axis + '1', function(d,i) { return scale(getData(d,i)) })
.attr(axis + '2', function(d,i) { return scale(getData(d,i)) })
@ -95,8 +93,7 @@ nv.models.distribution = function() {
//============================================================
// Expose Public Variables
//------------------------------------------------------------
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
@ -141,6 +138,7 @@ nv.models.distribution = function() {
color = nv.utils.getColor(_);
return chart;
};
//============================================================

@ -1,6 +1,6 @@
//TODO: consider deprecating and using multibar with single series for this
nv.models.historicalBar = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -20,10 +20,7 @@ nv.models.historicalBar = function() {
, color = nv.utils.defaultColor()
, xDomain
, yDomain
, xRange
, yRange
, dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
, interactive = true
;
//============================================================
@ -42,15 +39,15 @@ nv.models.historicalBar = function() {
x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) ))
if (padData)
x.range(xRange || [availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
else
x.range(xRange || [0, availableWidth]);
x.range([0, availableWidth]);
y .domain(yDomain || d3.extent(data[0].values.map(getY).concat(forceY) ))
.range(yRange || [availableHeight, 0]);
.range([availableHeight, 0]);
// If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true;
if (x.domain()[0] === x.domain()[1])
x.domain()[0] ?
x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
@ -67,8 +64,8 @@ nv.models.historicalBar = function() {
//------------------------------------------------------------
// Setup containers and skeleton of chart
var wrap = container.selectAll('g.nv-wrap.nv-historicalBar-' + id).data([data[0].values]);
var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-historicalBar-' + id);
var wrap = container.selectAll('g.nv-wrap.nv-bar').data([data[0].values]);
var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bar');
var defsEnter = wrapEnter.append('defs');
var gEnter = wrapEnter.append('g');
var g = wrap.select('g');
@ -104,7 +101,7 @@ nv.models.historicalBar = function() {
var bars = wrap.select('.nv-bars').selectAll('.nv-bar')
.data(function(d) { return d }, function(d,i) {return getX(d,i)});
.data(function(d) { return d });
bars.exit().remove();
@ -112,11 +109,9 @@ nv.models.historicalBar = function() {
var barsEnter = bars.enter().append('rect')
//.attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i })
.attr('x', 0 )
.attr('y', function(d,i) { return nv.utils.NaNtoZero(y(Math.max(0, getY(d,i)))) })
.attr('height', function(d,i) { return nv.utils.NaNtoZero(Math.abs(y(getY(d,i)) - y(0))) })
.attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; })
.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) })
.on('mouseover', function(d,i) {
if (!interactive) return;
d3.select(this).classed('hover', true);
dispatch.elementMouseover({
point: d,
@ -129,7 +124,6 @@ nv.models.historicalBar = function() {
})
.on('mouseout', function(d,i) {
if (!interactive) return;
d3.select(this).classed('hover', false);
dispatch.elementMouseout({
point: d,
@ -140,7 +134,6 @@ nv.models.historicalBar = function() {
});
})
.on('click', function(d,i) {
if (!interactive) return;
dispatch.elementClick({
//label: d[label],
value: getY(d,i),
@ -153,7 +146,6 @@ nv.models.historicalBar = function() {
d3.event.stopPropagation();
})
.on('dblclick', function(d,i) {
if (!interactive) return;
dispatch.elementDblClick({
//label: d[label],
value: getY(d,i),
@ -169,50 +161,34 @@ nv.models.historicalBar = function() {
bars
.attr('fill', function(d,i) { return color(d, i); })
.attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i })
.transition()
.attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; })
//TODO: better width calculations that don't assume always uniform data spacing;w
.attr('width', (availableWidth / data[0].values.length) * .9 );
.attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; }) //TODO: better width calculations that don't assume always uniform data spacing;w
.attr('width', (availableWidth / data[0].values.length) * .9 )
bars.transition()
d3.transition(bars)
//.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) })
.attr('y', function(d,i) {
var rval = getY(d,i) < 0 ?
return getY(d,i) < 0 ?
y(0) :
y(0) - y(getY(d,i)) < 1 ?
y(0) - 1 :
y(getY(d,i));
return nv.utils.NaNtoZero(rval);
y(getY(d,i))
})
.attr('height', function(d,i) { return nv.utils.NaNtoZero(Math.max(Math.abs(y(getY(d,i)) - y(0)),1)) });
.attr('height', function(d,i) { return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) });
//.order(); // not sure if this makes any sense for this model
});
return chart;
}
//Create methods to allow outside functions to highlight a specific bar.
chart.highlightPoint = function(pointIndex, isHoverOver) {
d3.select(".nv-historicalBar-" + id)
.select(".nv-bars .nv-bar-0-" + pointIndex)
.classed("hover", isHoverOver)
;
};
chart.clearHighlights = function() {
d3.select(".nv-historicalBar-" + id)
.select(".nv-bars .nv-bar.hover")
.classed("hover", false)
;
};
//============================================================
// Expose Public Variables
//------------------------------------------------------------
chart.dispatch = dispatch;
chart.options = nv.utils.optionsFunc.bind(chart);
chart.x = function(_) {
if (!arguments.length) return getX;
getX = _;
@ -270,18 +246,6 @@ nv.models.historicalBar = function() {
return chart;
};
chart.xRange = function(_) {
if (!arguments.length) return xRange;
xRange = _;
return chart;
};
chart.yRange = function(_) {
if (!arguments.length) return yRange;
yRange = _;
return chart;
};
chart.forceX = function(_) {
if (!arguments.length) return forceX;
forceX = _;
@ -318,12 +282,6 @@ nv.models.historicalBar = function() {
return chart;
};
chart.interactive = function(_) {
if(!arguments.length) return interactive;
interactive = false;
return chart;
};
//============================================================

@ -1,419 +0,0 @@
nv.models.historicalBarChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
var bars = nv.models.historicalBar()
, xAxis = nv.models.axis()
, yAxis = nv.models.axis()
, legend = nv.models.legend()
;
var margin = {top: 30, right: 90, bottom: 50, left: 90}
, color = nv.utils.defaultColor()
, width = null
, height = null
, showLegend = false
, showXAxis = true
, showYAxis = true
, rightAlignYAxis = false
, tooltips = true
, tooltip = function(key, x, y, e, graph) {
return '<h3>' + key + '</h3>' +
'<p>' + y + ' at ' + x + '</p>'
}
, x
, y
, state = {}
, defaultState = null
, noData = 'No Data Available.'
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
, transitionDuration = 250
;
xAxis
.orient('bottom')
.tickPadding(7)
;
yAxis
.orient( (rightAlignYAxis) ? 'right' : 'left')
;
//============================================================
//============================================================
// Private Variables
//------------------------------------------------------------
var showTooltip = function(e, offsetElement) {
// New addition to calculate position if SVG is scaled with viewBox, may move TODO: consider implementing everywhere else
if (offsetElement) {
var svg = d3.select(offsetElement).select('svg');
var viewBox = (svg.node()) ? svg.attr('viewBox') : null;
if (viewBox) {
viewBox = viewBox.split(' ');
var ratio = parseInt(svg.style('width')) / viewBox[2];
e.pos[0] = e.pos[0] * ratio;
e.pos[1] = e.pos[1] * ratio;
}
}
var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
top = e.pos[1] + ( offsetElement.offsetTop || 0),
x = xAxis.tickFormat()(bars.x()(e.point, e.pointIndex)),
y = yAxis.tickFormat()(bars.y()(e.point, e.pointIndex)),
content = tooltip(e.series.key, x, y, e, chart);
nv.tooltip.show([left, top], content, null, null, offsetElement);
};
//============================================================
function chart(selection) {
selection.each(function(data) {
var container = d3.select(this),
that = this;
var availableWidth = (width || parseInt(container.style('width')) || 960)
- margin.left - margin.right,
availableHeight = (height || parseInt(container.style('height')) || 400)
- margin.top - margin.bottom;
chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
chart.container = this;
//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.
if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
var noDataText = container.selectAll('.nv-noData').data([noData]);
noDataText.enter().append('text')
.attr('class', 'nvd3 nv-noData')
.attr('dy', '-.7em')
.style('text-anchor', 'middle');
noDataText
.attr('x', margin.left + availableWidth / 2)
.attr('y', margin.top + availableHeight / 2)
.text(function(d) { return d });
return chart;
} else {
container.selectAll('.nv-noData').remove();
}
//------------------------------------------------------------
//------------------------------------------------------------
// Setup Scales
x = bars.xScale();
y = bars.yScale();
//------------------------------------------------------------
//------------------------------------------------------------
// Setup containers and skeleton of chart
var wrap = container.selectAll('g.nv-wrap.nv-historicalBarChart').data([data]);
var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-historicalBarChart').append('g');
var g = wrap.select('g');
gEnter.append('g').attr('class', 'nv-x nv-axis');
gEnter.append('g').attr('class', 'nv-y nv-axis');
gEnter.append('g').attr('class', 'nv-barsWrap');
gEnter.append('g').attr('class', 'nv-legendWrap');
//------------------------------------------------------------
//------------------------------------------------------------
// Legend
if (showLegend) {
legend.width(availableWidth);
g.select('.nv-legendWrap')
.datum(data)
.call(legend);
if ( margin.top != legend.height()) {
margin.top = legend.height();
availableHeight = (height || parseInt(container.style('height')) || 400)
- margin.top - margin.bottom;
}
wrap.select('.nv-legendWrap')
.attr('transform', 'translate(0,' + (-margin.top) +')')
}
//------------------------------------------------------------
wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
if (rightAlignYAxis) {
g.select(".nv-y.nv-axis")
.attr("transform", "translate(" + availableWidth + ",0)");
}
//------------------------------------------------------------
// Main Chart Component(s)
bars
.width(availableWidth)
.height(availableHeight)
.color(data.map(function(d,i) {
return d.color || color(d, i);
}).filter(function(d,i) { return !data[i].disabled }));
var barsWrap = g.select('.nv-barsWrap')
.datum(data.filter(function(d) { return !d.disabled }))
barsWrap.transition().call(bars);
//------------------------------------------------------------
//------------------------------------------------------------
// Setup Axes
if (showXAxis) {
xAxis
.scale(x)
.tickSize(-availableHeight, 0);
g.select('.nv-x.nv-axis')
.attr('transform', 'translate(0,' + y.range()[0] + ')');
g.select('.nv-x.nv-axis')
.transition()
.call(xAxis);
}
if (showYAxis) {
yAxis
.scale(y)
.ticks( availableHeight / 36 )
.tickSize( -availableWidth, 0);
g.select('.nv-y.nv-axis')
.transition()
.call(yAxis);
}
//------------------------------------------------------------
//============================================================
// Event Handling/Dispatching (in chart's scope)
//------------------------------------------------------------
legend.dispatch.on('legendClick', function(d,i) {
d.disabled = !d.disabled;
if (!data.filter(function(d) { return !d.disabled }).length) {
data.map(function(d) {
d.disabled = false;
wrap.selectAll('.nv-series').classed('disabled', false);
return d;
});
}
state.disabled = data.map(function(d) { return !!d.disabled });
dispatch.stateChange(state);
selection.transition().call(chart);
});
legend.dispatch.on('legendDblclick', function(d) {
//Double clicking should always enable current series, and disabled all others.
data.forEach(function(d) {
d.disabled = true;
});
d.disabled = false;
state.disabled = data.map(function(d) { return !!d.disabled });
dispatch.stateChange(state);
chart.update();
});
dispatch.on('tooltipShow', function(e) {
if (tooltips) showTooltip(e, that.parentNode);
});
dispatch.on('changeState', function(e) {
if (typeof e.disabled !== 'undefined') {
data.forEach(function(series,i) {
series.disabled = e.disabled[i];
});
state.disabled = e.disabled;
}
chart.update();
});
//============================================================
});
return chart;
}
//============================================================
// Event Handling/Dispatching (out of chart's scope)
//------------------------------------------------------------
bars.dispatch.on('elementMouseover.tooltip', function(e) {
e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
dispatch.tooltipShow(e);
});
bars.dispatch.on('elementMouseout.tooltip', function(e) {
dispatch.tooltipHide(e);
});
dispatch.on('tooltipHide', function() {
if (tooltips) nv.tooltip.cleanup();
});
//============================================================
//============================================================
// Expose Public Variables
//------------------------------------------------------------
// expose chart's sub-components
chart.dispatch = dispatch;
chart.bars = bars;
chart.legend = legend;
chart.xAxis = xAxis;
chart.yAxis = yAxis;
d3.rebind(chart, bars, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale',
'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate','highlightPoint','clearHighlights', 'interactive');
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
return chart;
};
chart.width = function(_) {
if (!arguments.length) return width;
width = _;
return chart;
};
chart.height = function(_) {
if (!arguments.length) return height;
height = _;
return chart;
};
chart.color = function(_) {
if (!arguments.length) return color;
color = nv.utils.getColor(_);
legend.color(color);
return chart;
};
chart.showLegend = function(_) {
if (!arguments.length) return showLegend;
showLegend = _;
return chart;
};
chart.showXAxis = function(_) {
if (!arguments.length) return showXAxis;
showXAxis = _;
return chart;
};
chart.showYAxis = function(_) {
if (!arguments.length) return showYAxis;
showYAxis = _;
return chart;
};
chart.rightAlignYAxis = function(_) {
if(!arguments.length) return rightAlignYAxis;
rightAlignYAxis = _;
yAxis.orient( (_) ? 'right' : 'left');
return chart;
};
chart.tooltips = function(_) {
if (!arguments.length) return tooltips;
tooltips = _;
return chart;
};
chart.tooltipContent = function(_) {
if (!arguments.length) return tooltip;
tooltip = _;
return chart;
};
chart.state = function(_) {
if (!arguments.length) return state;
state = _;
return chart;
};
chart.defaultState = function(_) {
if (!arguments.length) return defaultState;
defaultState = _;
return chart;
};
chart.noData = function(_) {
if (!arguments.length) return noData;
noData = _;
return chart;
};
chart.transitionDuration = function(_) {
if (!arguments.length) return transitionDuration;
transitionDuration = _;
return chart;
};
//============================================================
return chart;
}

@ -1,337 +1,317 @@
nv.models.indentedTree = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
var margin = {top: 0, right: 0, bottom: 0, left: 0} //TODO: implement, maybe as margin on the containing div
, width = 960
, height = 500
, color = nv.utils.defaultColor()
, id = Math.floor(Math.random() * 10000)
, header = true
, filterZero = false
, noData = "No Data Available."
, childIndent = 20
, columns = [{key:'key', label: 'Name', type:'text'}] //TODO: consider functions like chart.addColumn, chart.removeColumn, instead of a block like this
, tableClass = null
, iconOpen = 'images/grey-plus.png' //TODO: consider removing this and replacing with a '+' or '-' unless user defines images
, iconClose = 'images/grey-minus.png'
, dispatch = d3.dispatch('elementClick', 'elementDblclick', 'elementMouseover', 'elementMouseout')
, getUrl = function(d) { return d.url }
;
//============================================================
var idx = 0;
function chart(selection) {
selection.each(function(data) {
var depth = 1,
container = d3.select(this);
var tree = d3.layout.tree()
.children(function(d) { return d.values })
.size([height, childIndent]); //Not sure if this is needed now that the result is HTML
chart.update = function() { container.transition().duration(600).call(chart) };
//------------------------------------------------------------
// Display No Data message if there's nothing to show.
if (!data[0]) data[0] = {key: noData};
//------------------------------------------------------------
var nodes = tree.nodes(data[0]);
// nodes.map(function(d) {
// d.id = i++;
// })
//------------------------------------------------------------
// Setup containers and skeleton of chart
var wrap = d3.select(this).selectAll('div').data([[nodes]]);
var wrapEnter = wrap.enter().append('div').attr('class', 'nvd3 nv-wrap nv-indentedtree');
var tableEnter = wrapEnter.append('table');
var table = wrap.select('table').attr('width', '100%').attr('class', tableClass);
//------------------------------------------------------------
if (header) {
var thead = tableEnter.append('thead');
var theadRow1 = thead.append('tr');
columns.forEach(function(column) {
theadRow1
.append('th')
.attr('width', column.width ? column.width : '10%')
.style('text-align', column.type == 'numeric' ? 'right' : 'left')
.append('span')
.text(column.label);
});
}
var tbody = table.selectAll('tbody')
.data(function(d) { return d });
tbody.enter().append('tbody');
//compute max generations
depth = d3.max(nodes, function(node) { return node.depth });
tree.size([height, depth * childIndent]); //TODO: see if this is necessary at all
// Update the nodes…
var node = tbody.selectAll('tr')
// .data(function(d) { return d; }, function(d) { return d.id || (d.id == ++i)});
.data(function(d) { return d.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; } )}, function(d,i) { return d.id || (d.id || ++idx)});
//.style('display', 'table-row'); //TODO: see if this does anything
node.exit().remove();
node.select('img.nv-treeicon')
.attr('src', icon)
.classed('folded', folded);
var nodeEnter = node.enter().append('tr');
columns.forEach(function(column, index) {
var nodeName = nodeEnter.append('td')
.style('padding-left', function(d) { return (index ? 0 : d.depth * childIndent + 12 + (icon(d) ? 0 : 16)) + 'px' }, 'important') //TODO: check why I did the ternary here
.style('text-align', column.type == 'numeric' ? 'right' : 'left');
if (index == 0) {
nodeName.append('img')
.classed('nv-treeicon', true)
.classed('nv-folded', folded)
.attr('src', icon)
.style('width', '14px')
.style('height', '14px')
.style('padding', '0 1px')
.style('display', function(d) { return icon(d) ? 'inline-block' : 'none'; })
.on('click', click);
}
nodeName.each(function(d) {
if (!index && getUrl(d))
d3.select(this)
.append('a')
.attr('href',getUrl)
.attr('class', d3.functor(column.classes))
.append('span')
else
d3.select(this)
.append('span')
d3.select(this).select('span')
.attr('class', d3.functor(column.classes) )
.text(function(d) { return column.format ? column.format(d) :
(d[column.key] || '-') });
});
if (column.showCount) {
nodeName.append('span')
.attr('class', 'nv-childrenCount');
node.selectAll('span.nv-childrenCount').text(function(d) {
return ((d.values && d.values.length) || (d._values && d._values.length)) ? //If this is a parent
'(' + ((d.values && (d.values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length)) //If children are in values check its children and filter
|| (d._values && d._values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length) //Otherwise, do the same, but with the other name, _values...
|| 0) + ')' //This is the catch-all in case there are no children after a filter
: '' //If this is not a parent, just give an empty string
});
}
// if (column.click)
// nodeName.select('span').on('click', column.click);
});
node
.order()
.on('click', function(d) {
dispatch.elementClick({
row: this, //TODO: decide whether or not this should be consistent with scatter/line events or should be an html link (a href)
data: d,
pos: [d.x, d.y]
});
})
.on('dblclick', function(d) {
dispatch.elementDblclick({
row: this,
data: d,
pos: [d.x, d.y]
});
})
.on('mouseover', function(d) {
dispatch.elementMouseover({
row: this,
data: d,
pos: [d.x, d.y]
});
})
.on('mouseout', function(d) {
dispatch.elementMouseout({
row: this,
data: d,
pos: [d.x, d.y]
});
});
// Toggle children on click.
function click(d, _, unshift) {
d3.event.stopPropagation();
if(d3.event.shiftKey && !unshift) {
//If you shift-click, it'll toggle fold all the children, instead of itself
d3.event.shiftKey = false;
d.values && d.values.forEach(function(node){
if (node.values || node._values) {
click(node, 0, true);
}
});
return true;
}
if(!hasChildren(d)) {
//download file
//window.location.href = d.url;
return true;
}
if (d.values) {
d._values = d.values;
d.values = null;
} else {
d.values = d._values;
d._values = null;
}
chart.update();
}
function icon(d) {
return (d._values && d._values.length) ? iconOpen : (d.values && d.values.length) ? iconClose : '';
}
function folded(d) {
return (d._values && d._values.length);
}
function hasChildren(d) {
var values = d.values || d._values;
return (values && values.length);
}
});
return chart;
}
//============================================================
// Expose Public Variables
//------------------------------------------------------------
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
return chart;
};
chart.width = function(_) {
if (!arguments.length) return width;
width = _;
return chart;
};
chart.height = function(_) {
if (!arguments.length) return height;
height = _;
return chart;
};
chart.color = function(_) {
if (!arguments.length) return color;
color = nv.utils.getColor(_);
scatter.color(color);
return chart;
};
chart.id = function(_) {
if (!arguments.length) return id;
id = _;
return chart;
};
chart.header = function(_) {
if (!arguments.length) return header;
header = _;
return chart;
};
chart.noData = function(_) {
if (!arguments.length) return noData;
noData = _;
return chart;
};
chart.filterZero = function(_) {
if (!arguments.length) return filterZero;
filterZero = _;
return chart;
};
chart.columns = function(_) {
if (!arguments.length) return columns;
columns = _;
return chart;
};
chart.tableClass = function(_) {
if (!arguments.length) return tableClass;
tableClass = _;
return chart;
};
chart.iconOpen = function(_){
if (!arguments.length) return iconOpen;
iconOpen = _;
return chart;
}
chart.iconClose = function(_){
if (!arguments.length) return iconClose;
iconClose = _;
return chart;
}
chart.getUrl = function(_){
if (!arguments.length) return getUrl;
getUrl = _;
return chart;
}
//============================================================
return chart;
nv.models.indentedTree = function() {
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
var margin = {top: 0, right: 0, bottom: 0, left: 0} //TODO: implement, maybe as margin on the containing div
, width = 960
, height = 500
, color = nv.utils.defaultColor()
, id = Math.floor(Math.random() * 10000)
, header = true
, filterZero = false
, noData = "No Data Available."
, childIndent = 20
, columns = [{key:'key', label: 'Name', type:'text'}] //TODO: consider functions like chart.addColumn, chart.removeColumn, instead of a block like this
, tableClass = null
, iconOpen = 'images/grey-plus.png' //TODO: consider removing this and replacing with a '+' or '-' unless user defines images
, iconClose = 'images/grey-minus.png'
, dispatch = d3.dispatch('elementClick', 'elementDblclick', 'elementMouseover', 'elementMouseout')
;
//============================================================
var idx = 0;
function chart(selection) {
selection.each(function(data) {
var depth = 1,
container = d3.select(this);
var tree = d3.layout.tree()
.children(function(d) { return d.values })
.size([height, childIndent]); //Not sure if this is needed now that the result is HTML
chart.update = function() { container.transition().duration(600).call(chart) };
//------------------------------------------------------------
// Display No Data message if there's nothing to show.
if (!data[0]) data[0] = {key: noData};
//------------------------------------------------------------
var nodes = tree.nodes(data[0]);
// nodes.map(function(d) {
// d.id = i++;
// })
//------------------------------------------------------------
// Setup containers and skeleton of chart
var wrap = d3.select(this).selectAll('div').data([[nodes]]);
var wrapEnter = wrap.enter().append('div').attr('class', 'nvd3 nv-wrap nv-indentedtree');
var tableEnter = wrapEnter.append('table');
var table = wrap.select('table').attr('width', '100%').attr('class', tableClass);
//------------------------------------------------------------
if (header) {
var thead = tableEnter.append('thead');
var theadRow1 = thead.append('tr');
columns.forEach(function(column) {
theadRow1
.append('th')
.attr('width', column.width ? column.width : '10%')
.style('text-align', column.type == 'numeric' ? 'right' : 'left')
.append('span')
.text(column.label);
});
}
var tbody = table.selectAll('tbody')
.data(function(d) { return d });
tbody.enter().append('tbody');
//compute max generations
depth = d3.max(nodes, function(node) { return node.depth });
tree.size([height, depth * childIndent]); //TODO: see if this is necessary at all
// Update the nodes…
var node = tbody.selectAll('tr')
// .data(function(d) { return d; }, function(d) { return d.id || (d.id == ++i)});
.data(function(d) { return d.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; } )}, function(d,i) { return d.id || (d.id || ++idx)});
//.style('display', 'table-row'); //TODO: see if this does anything
node.exit().remove();
node.select('img.nv-treeicon')
.attr('src', icon)
.classed('folded', folded);
var nodeEnter = node.enter().append('tr');
columns.forEach(function(column, index) {
var nodeName = nodeEnter.append('td')
.style('padding-left', function(d) { return (index ? 0 : d.depth * childIndent + 12 + (icon(d) ? 0 : 16)) + 'px' }, 'important') //TODO: check why I did the ternary here
.style('text-align', column.type == 'numeric' ? 'right' : 'left');
if (index == 0) {
nodeName.append('img')
.classed('nv-treeicon', true)
.classed('nv-folded', folded)
.attr('src', icon)
.style('width', '14px')
.style('height', '14px')
.style('padding', '0 1px')
.style('display', function(d) { return icon(d) ? 'inline-block' : 'none'; })
.on('click', click);
}
nodeName.append('span')
.attr('class', d3.functor(column.classes) )
.text(function(d) { return column.format ? column.format(d) :
(d[column.key] || '-') });
if (column.showCount) {
nodeName.append('span')
.attr('class', 'nv-childrenCount');
node.selectAll('span.nv-childrenCount').text(function(d) {
return ((d.values && d.values.length) || (d._values && d._values.length)) ? //If this is a parent
'(' + ((d.values && (d.values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length)) //If children are in values check its children and filter
|| (d._values && d._values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length) //Otherwise, do the same, but with the other name, _values...
|| 0) + ')' //This is the catch-all in case there are no children after a filter
: '' //If this is not a parent, just give an empty string
});
}
if (column.click)
nodeName.select('span').on('click', column.click);
});
node
.order()
.on('click', function(d) {
dispatch.elementClick({
row: this, //TODO: decide whether or not this should be consistent with scatter/line events or should be an html link (a href)
data: d,
pos: [d.x, d.y]
});
})
.on('dblclick', function(d) {
dispatch.elementDblclick({
row: this,
data: d,
pos: [d.x, d.y]
});
})
.on('mouseover', function(d) {
dispatch.elementMouseover({
row: this,
data: d,
pos: [d.x, d.y]
});
})
.on('mouseout', function(d) {
dispatch.elementMouseout({
row: this,
data: d,
pos: [d.x, d.y]
});
});
// Toggle children on click.
function click(d, _, unshift) {
d3.event.stopPropagation();
if(d3.event.shiftKey && !unshift) {
//If you shift-click, it'll toggle fold all the children, instead of itself
d3.event.shiftKey = false;
d.values && d.values.forEach(function(node){
if (node.values || node._values) {
click(node, 0, true);
}
});
return true;
}
if(!hasChildren(d)) {
//download file
//window.location.href = d.url;
return true;
}
if (d.values) {
d._values = d.values;
d.values = null;
} else {
d.values = d._values;
d._values = null;
}
chart.update();
}
function icon(d) {
return (d._values && d._values.length) ? iconOpen : (d.values && d.values.length) ? iconClose : '';
}
function folded(d) {
return (d._values && d._values.length);
}
function hasChildren(d) {
var values = d.values || d._values;
return (values && values.length);
}
});
return chart;
}
//============================================================
// Expose Public Variables
//------------------------------------------------------------
chart.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
return chart;
};
chart.width = function(_) {
if (!arguments.length) return width;
width = _;
return chart;
};
chart.height = function(_) {
if (!arguments.length) return height;
height = _;
return chart;
};
chart.color = function(_) {
if (!arguments.length) return color;
color = nv.utils.getColor(_);
scatter.color(color);
return chart;
};
chart.id = function(_) {
if (!arguments.length) return id;
id = _;
return chart;
};
chart.header = function(_) {
if (!arguments.length) return header;
header = _;
return chart;
};
chart.noData = function(_) {
if (!arguments.length) return noData;
noData = _;
return chart;
};
chart.filterZero = function(_) {
if (!arguments.length) return filterZero;
filterZero = _;
return chart;
};
chart.columns = function(_) {
if (!arguments.length) return columns;
columns = _;
return chart;
};
chart.tableClass = function(_) {
if (!arguments.length) return tableClass;
tableClass = _;
return chart;
};
chart.iconOpen = function(_){
if (!arguments.length) return iconOpen;
iconOpen = _;
return chart;
}
chart.iconClose = function(_){
if (!arguments.length) return iconClose;
iconClose = _;
return chart;
}
//============================================================
return chart;
};

@ -1,5 +1,5 @@
nv.models.legend = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -10,10 +10,7 @@ nv.models.legend = function() {
, getKey = function(d) { return d.key }
, color = nv.utils.defaultColor()
, align = true
, rightAlign = true
, updateState = true //If true, legend will update data.disabled and trigger a 'stateChange' dispatch.
, radioButtonMode = false //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at a time)
, dispatch = d3.dispatch('legendClick', 'legendDblclick', 'legendMouseover', 'legendMouseout', 'stateChange')
, dispatch = d3.dispatch('legendClick', 'legendDblclick', 'legendMouseover', 'legendMouseout')
;
//============================================================
@ -48,47 +45,15 @@ nv.models.legend = function() {
})
.on('click', function(d,i) {
dispatch.legendClick(d,i);
if (updateState) {
if (radioButtonMode) {
//Radio button mode: set every series to disabled,
// and enable the clicked series.
data.forEach(function(series) { series.disabled = true});
d.disabled = false;
}
else {
d.disabled = !d.disabled;
if (data.every(function(series) { return series.disabled})) {
//the default behavior of NVD3 legends is, if every single series
// is disabled, turn all series' back on.
data.forEach(function(series) { series.disabled = false});
}
}
dispatch.stateChange({
disabled: data.map(function(d) { return !!d.disabled })
});
}
})
.on('dblclick', function(d,i) {
dispatch.legendDblclick(d,i);
if (updateState) {
//the default behavior of NVD3 legends, when double clicking one,
// is to set all other series' to false, and make the double clicked series enabled.
data.forEach(function(series) {
series.disabled = true;
});
d.disabled = false;
dispatch.stateChange({
disabled: data.map(function(d) { return !!d.disabled })
});
}
});
seriesEnter.append('circle')
.style('stroke-width', 2)
.attr('class','nv-legend-symbol')
.attr('r', 5);
seriesEnter.append('text')
.attr('text-anchor', 'start')
.attr('class','nv-legend-text')
.attr('dy', '.32em')
.attr('dx', '8');
series.classed('disabled', function(d) { return d.disabled });
@ -107,19 +72,13 @@ nv.models.legend = function() {
var seriesWidths = [];
series.each(function(d,i) {
var legendText = d3.select(this).select('text');
var nodeTextLength;
try {
nodeTextLength = legendText.getComputedTextLength();
// If the legendText is display:none'd (nodeTextLength == 0), simulate an error so we approximate, instead
if(nodeTextLength <= 0) throw Error();
}
catch(e) {
nodeTextLength = nv.utils.calcApproxTextWidth(legendText);
}
seriesWidths.push(nodeTextLength + 28); // 28 is ~ the width of the circle plus some padding
var svgComputedTextLength = legendText.node().getComputedTextLength()
|| nv.utils.calcApproxTextWidth(legendText);
seriesWidths.push(svgComputedTextLength + 28); // 28 is ~ the width of the circle plus some padding
});
//nv.log('Series Widths: ', JSON.stringify(seriesWidths));
var seriesPerRow = 0;
var legendWidth = 0;
var columnWidths = [];
@ -128,14 +87,13 @@ nv.models.legend = function() {
columnWidths[seriesPerRow] = seriesWidths[seriesPerRow];
legendWidth += seriesWidths[seriesPerRow++];
}
if (seriesPerRow === 0) seriesPerRow = 1; //minimum of one series per row
while ( legendWidth > availableWidth && seriesPerRow > 1 ) {
columnWidths = [];
seriesPerRow--;
for (var k = 0; k < seriesWidths.length; k++) {
for (k = 0; k < seriesWidths.length; k++) {
if (seriesWidths[k] > (columnWidths[k % seriesPerRow] || 0) )
columnWidths[k % seriesPerRow] = seriesWidths[k];
}
@ -144,6 +102,7 @@ nv.models.legend = function() {
return prev + cur;
});
}
//console.log(columnWidths, legendWidth, seriesPerRow);
var xPositions = [];
for (var i = 0, curX = 0; i < seriesPerRow; i++) {
@ -157,12 +116,7 @@ nv.models.legend = function() {
});
//position legend as far right as possible within the total width
if (rightAlign) {
g.attr('transform', 'translate(' + (width - margin.right - legendWidth) + ',' + margin.top + ')');
}
else {
g.attr('transform', 'translate(0' + ',' + margin.top + ')');
}
g.attr('transform', 'translate(' + (width - margin.right - legendWidth) + ',' + margin.top + ')');
height = margin.top + margin.bottom + (Math.ceil(seriesWidths.length / seriesPerRow) * 20);
@ -206,7 +160,6 @@ nv.models.legend = function() {
//------------------------------------------------------------
chart.dispatch = dispatch;
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if (!arguments.length) return margin;
@ -247,24 +200,6 @@ nv.models.legend = function() {
return chart;
};
chart.rightAlign = function(_) {
if (!arguments.length) return rightAlign;
rightAlign = _;
return chart;
};
chart.updateState = function(_) {
if (!arguments.length) return updateState;
updateState = _;
return chart;
};
chart.radioButtonMode = function(_) {
if (!arguments.length) return radioButtonMode;
radioButtonMode = _;
return chart;
};
//============================================================

@ -1,6 +1,6 @@
nv.models.line = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -84,7 +84,7 @@ nv.models.line = function() {
var scatterWrap = wrap.select('.nv-scatterWrap');
//.datum(data); // Data automatically trickles down from the wrap
scatterWrap.transition().call(scatter);
d3.transition(scatterWrap).call(scatter);
@ -94,7 +94,7 @@ nv.models.line = function() {
wrap.select('#nv-edge-clip-' + scatter.id() + ' rect')
.attr('width', availableWidth)
.attr('height', (availableHeight > 0) ? availableHeight : 0);
.attr('height', availableHeight);
g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : '');
scatterWrap
@ -108,16 +108,16 @@ nv.models.line = function() {
groups.enter().append('g')
.style('stroke-opacity', 1e-6)
.style('fill-opacity', 1e-6);
groups.exit().remove();
d3.transition(groups.exit())
.style('stroke-opacity', 1e-6)
.style('fill-opacity', 1e-6)
.remove();
groups
.attr('class', function(d,i) { return 'nv-group nv-series-' + i })
.classed('hover', function(d) { return d.hover })
.style('fill', function(d,i){ return color(d, i) })
.style('stroke', function(d,i){ return color(d, i)});
groups
.transition()
d3.transition(groups)
.style('stroke-opacity', 1)
.style('fill-opacity', .5);
@ -131,24 +131,31 @@ nv.models.line = function() {
return d3.svg.area()
.interpolate(interpolate)
.defined(defined)
.x(function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) })
.y0(function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) })
.x(function(d,i) { return x0(getX(d,i)) })
.y0(function(d,i) { return y0(getY(d,i)) })
.y1(function(d,i) { return y0( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
//.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this
.apply(this, [d.values])
});
groups.exit().selectAll('path.nv-area')
.remove();
areaPaths
.transition()
d3.transition(groups.exit().selectAll('path.nv-area'))
.attr('d', function(d) {
return d3.svg.area()
.interpolate(interpolate)
.defined(defined)
.x(function(d,i) { return x0(getX(d,i)) })
.y0(function(d,i) { return y0(getY(d,i)) })
.y1(function(d,i) { return y0( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
//.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this
.apply(this, [d.values])
});
d3.transition(areaPaths)
.attr('d', function(d) {
return d3.svg.area()
.interpolate(interpolate)
.defined(defined)
.x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
.y0(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
.y1(function(d,i) { return y( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
.x(function(d,i) { return x0(getX(d,i)) })
.y0(function(d,i) { return y0(getY(d,i)) })
.y1(function(d,i) { return y0( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) })
//.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this
.apply(this, [d.values])
});
@ -163,18 +170,24 @@ nv.models.line = function() {
d3.svg.line()
.interpolate(interpolate)
.defined(defined)
.x(function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) })
.y(function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) })
.x(function(d,i) { return x0(getX(d,i)) })
.y(function(d,i) { return y0(getY(d,i)) })
);
linePaths
.transition()
d3.transition(groups.exit().selectAll('path.nv-line'))
.attr('d',
d3.svg.line()
.interpolate(interpolate)
.defined(defined)
.x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
.y(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
.x(function(d,i) { return x(getX(d,i)) })
.y(function(d,i) { return y(getY(d,i)) })
);
d3.transition(linePaths)
.attr('d',
d3.svg.line()
.interpolate(interpolate)
.defined(defined)
.x(function(d,i) { return x(getX(d,i)) })
.y(function(d,i) { return y(getY(d,i)) })
);
@ -196,10 +209,7 @@ nv.models.line = function() {
chart.dispatch = scatter.dispatch;
chart.scatter = scatter;
d3.rebind(chart, scatter, 'id', 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange',
'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'useVoronoi', 'clipRadius', 'padData','highlightPoint','clearHighlights');
chart.options = nv.utils.optionsFunc.bind(chart);
d3.rebind(chart, scatter, 'id', 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'padData');
chart.margin = function(_) {
if (!arguments.length) return margin;

@ -1,6 +1,6 @@
nv.models.lineChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -9,18 +9,14 @@ nv.models.lineChart = function() {
, xAxis = nv.models.axis()
, yAxis = nv.models.axis()
, legend = nv.models.legend()
, interactiveLayer = nv.interactiveGuideline()
;
//set margin.right to 23 to fit dates on the x-axis within the chart
var margin = {top: 30, right: 20, bottom: 50, left: 60}
, color = nv.utils.defaultColor()
, width = null
, height = null
, showLegend = true
, showXAxis = true
, showYAxis = true
, rightAlignYAxis = false
, useInteractiveGuideline = false
, tooltips = true
, tooltip = function(key, x, y, e, graph) {
return '<h3>' + key + '</h3>' +
@ -32,7 +28,6 @@ nv.models.lineChart = function() {
, defaultState = null
, noData = 'No Data Available.'
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
, transitionDuration = 250
;
xAxis
@ -40,7 +35,7 @@ nv.models.lineChart = function() {
.tickPadding(7)
;
yAxis
.orient((rightAlignYAxis) ? 'right' : 'left')
.orient('left')
;
//============================================================
@ -51,6 +46,19 @@ nv.models.lineChart = function() {
//------------------------------------------------------------
var showTooltip = function(e, offsetElement) {
// New addition to calculate position if SVG is scaled with viewBox, may move TODO: consider implementing everywhere else
if (offsetElement) {
var svg = d3.select(offsetElement).select('svg');
var viewBox = (svg.node()) ? svg.attr('viewBox') : null;
if (viewBox) {
viewBox = viewBox.split(' ');
var ratio = parseInt(svg.style('width')) / viewBox[2];
e.pos[0] = e.pos[0] * ratio;
e.pos[1] = e.pos[1] * ratio;
}
}
var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
top = e.pos[1] + ( offsetElement.offsetTop || 0),
x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
@ -74,13 +82,12 @@ nv.models.lineChart = function() {
- margin.top - margin.bottom;
chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
chart.update = function() { chart(selection) };
chart.container = this;
//set state.disabled
state.disabled = data.map(function(d) { return !!d.disabled });
if (!defaultState) {
var key;
defaultState = {};
@ -132,16 +139,14 @@ nv.models.lineChart = function() {
var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g');
var g = wrap.select('g');
gEnter.append("rect").style("opacity",0);
gEnter.append('g').attr('class', 'nv-x nv-axis');
gEnter.append('g').attr('class', 'nv-y nv-axis');
gEnter.append('g').attr('class', 'nv-linesWrap');
gEnter.append('g').attr('class', 'nv-legendWrap');
gEnter.append('g').attr('class', 'nv-interactive');
g.select("rect")
.attr("width",availableWidth)
.attr("height",(availableHeight > 0) ? availableHeight : 0);
//------------------------------------------------------------
//------------------------------------------------------------
// Legend
@ -166,28 +171,10 @@ nv.models.lineChart = function() {
wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
if (rightAlignYAxis) {
g.select(".nv-y.nv-axis")
.attr("transform", "translate(" + availableWidth + ",0)");
}
//------------------------------------------------------------
// Main Chart Component(s)
//------------------------------------------------------------
//Set up interactive layer
if (useInteractiveGuideline) {
interactiveLayer
.width(availableWidth)
.height(availableHeight)
.margin({left:margin.left, top:margin.top})
.svgContainer(container)
.xScale(x);
wrap.select(".nv-interactive").call(interactiveLayer);
}
lines
.width(availableWidth)
.height(availableHeight)
@ -199,7 +186,7 @@ nv.models.lineChart = function() {
var linesWrap = g.select('.nv-linesWrap')
.datum(data.filter(function(d) { return !d.disabled }))
linesWrap.transition().call(lines);
d3.transition(linesWrap).call(lines);
//------------------------------------------------------------
@ -207,29 +194,25 @@ nv.models.lineChart = function() {
//------------------------------------------------------------
// Setup Axes
if (showXAxis) {
xAxis
.scale(x)
.ticks( availableWidth / 100 )
.tickSize(-availableHeight, 0);
g.select('.nv-x.nv-axis')
.attr('transform', 'translate(0,' + y.range()[0] + ')');
g.select('.nv-x.nv-axis')
.transition()
.call(xAxis);
}
xAxis
.scale(x)
.ticks( availableWidth / 100 )
.tickSize(-availableHeight, 0);
if (showYAxis) {
yAxis
.scale(y)
.ticks( availableHeight / 36 )
.tickSize( -availableWidth, 0);
g.select('.nv-x.nv-axis')
.attr('transform', 'translate(0,' + y.range()[0] + ')');
d3.transition(g.select('.nv-x.nv-axis'))
.call(xAxis);
yAxis
.scale(y)
.ticks( availableHeight / 36 )
.tickSize( -availableWidth, 0);
d3.transition(g.select('.nv-y.nv-axis'))
.call(yAxis);
g.select('.nv-y.nv-axis')
.transition()
.call(yAxis);
}
//------------------------------------------------------------
@ -237,66 +220,34 @@ nv.models.lineChart = function() {
// Event Handling/Dispatching (in chart's scope)
//------------------------------------------------------------
legend.dispatch.on('stateChange', function(newState) {
state = newState;
dispatch.stateChange(state);
chart.update();
});
legend.dispatch.on('legendClick', function(d,i) {
d.disabled = !d.disabled;
interactiveLayer.dispatch.on('elementMousemove', function(e) {
lines.clearHighlights();
var singlePoint, pointIndex, pointXLocation, allData = [];
data
.filter(function(series, i) {
series.seriesIndex = i;
return !series.disabled;
})
.forEach(function(series,i) {
pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x());
lines.highlightPoint(i, pointIndex, true);
var point = series.values[pointIndex];
if (typeof point === 'undefined') return;
if (typeof singlePoint === 'undefined') singlePoint = point;
if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex));
allData.push({
key: series.key,
value: chart.y()(point, pointIndex),
color: color(series,series.seriesIndex)
});
if (!data.filter(function(d) { return !d.disabled }).length) {
data.map(function(d) {
d.disabled = false;
wrap.selectAll('.nv-series').classed('disabled', false);
return d;
});
//Highlight the tooltip entry based on which point the mouse is closest to.
if (allData.length > 2) {
var yValue = chart.yScale().invert(e.mouseY);
var domainExtent = Math.abs(chart.yScale().domain()[0] - chart.yScale().domain()[1]);
var threshold = 0.03 * domainExtent;
var indexToHighlight = nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold);
if (indexToHighlight !== null)
allData[indexToHighlight].highlight = true;
}
var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));
interactiveLayer.tooltip
.position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
.chartContainer(that.parentNode)
.enabled(tooltips)
.valueFormatter(function(d,i) {
return yAxis.tickFormat()(d);
})
.data(
{
value: xValue,
series: allData
}
)();
interactiveLayer.renderGuideLine(pointXLocation);
}
state.disabled = data.map(function(d) { return !!d.disabled });
dispatch.stateChange(state);
selection.transition().call(chart);
});
/*
legend.dispatch.on('legendMouseover', function(d, i) {
d.hover = true;
selection.transition().call(chart)
});
interactiveLayer.dispatch.on("elementMouseout",function(e) {
dispatch.tooltipHide();
lines.clearHighlights();
legend.dispatch.on('legendMouseout', function(d, i) {
d.hover = false;
selection.transition().call(chart)
});
*/
dispatch.on('tooltipShow', function(e) {
if (tooltips) showTooltip(e, that.parentNode);
@ -305,7 +256,7 @@ nv.models.lineChart = function() {
dispatch.on('changeState', function(e) {
if (typeof e.disabled !== 'undefined' && data.length === e.disabled.length) {
if (typeof e.disabled !== 'undefined') {
data.forEach(function(series,i) {
series.disabled = e.disabled[i];
});
@ -313,7 +264,7 @@ nv.models.lineChart = function() {
state.disabled = e.disabled;
}
chart.update();
selection.call(chart);
});
//============================================================
@ -354,12 +305,8 @@ nv.models.lineChart = function() {
chart.legend = legend;
chart.xAxis = xAxis;
chart.yAxis = yAxis;
chart.interactiveLayer = interactiveLayer;
d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'xRange', 'yRange'
, 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'useVoronoi','id', 'interpolate');
chart.options = nv.utils.optionsFunc.bind(chart);
d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate');
chart.margin = function(_) {
if (!arguments.length) return margin;
@ -395,35 +342,6 @@ nv.models.lineChart = function() {
return chart;
};
chart.showXAxis = function(_) {
if (!arguments.length) return showXAxis;
showXAxis = _;
return chart;
};
chart.showYAxis = function(_) {
if (!arguments.length) return showYAxis;
showYAxis = _;
return chart;
};
chart.rightAlignYAxis = function(_) {
if(!arguments.length) return rightAlignYAxis;
rightAlignYAxis = _;
yAxis.orient( (_) ? 'right' : 'left');
return chart;
};
chart.useInteractiveGuideline = function(_) {
if(!arguments.length) return useInteractiveGuideline;
useInteractiveGuideline = _;
if (_ === true) {
chart.interactive(false);
chart.useVoronoi(false);
}
return chart;
};
chart.tooltips = function(_) {
if (!arguments.length) return tooltips;
tooltips = _;
@ -454,12 +372,6 @@ nv.models.lineChart = function() {
return chart;
};
chart.transitionDuration = function(_) {
if (!arguments.length) return transitionDuration;
transitionDuration = _;
return chart;
};
//============================================================

@ -1,6 +1,6 @@
nv.models.linePlusBarChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -85,8 +85,8 @@ nv.models.linePlusBarChart = function() {
availableHeight = (height || parseInt(container.style('height')) || 400)
- margin.top - margin.bottom;
chart.update = function() { container.transition().call(chart); };
// chart.container = this;
chart.update = function() { chart(selection) };
chart.container = this;
//set state.disabled
state.disabled = data.map(function(d) { return !!d.disabled });
@ -264,10 +264,21 @@ nv.models.linePlusBarChart = function() {
// Event Handling/Dispatching (in chart's scope)
//------------------------------------------------------------
legend.dispatch.on('stateChange', function(newState) {
state = newState;
legend.dispatch.on('legendClick', function(d,i) {
d.disabled = !d.disabled;
if (!data.filter(function(d) { return !d.disabled }).length) {
data.map(function(d) {
d.disabled = false;
wrap.selectAll('.nv-series').classed('disabled', false);
return d;
});
}
state.disabled = data.map(function(d) { return !!d.disabled });
dispatch.stateChange(state);
chart.update();
selection.transition().call(chart);
});
dispatch.on('tooltipShow', function(e) {
@ -286,7 +297,7 @@ nv.models.linePlusBarChart = function() {
state.disabled = e.disabled;
}
chart.update();
selection.call(chart);
});
//============================================================
@ -342,10 +353,8 @@ nv.models.linePlusBarChart = function() {
d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate');
//TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc.
//d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
//d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
chart.options = nv.utils.optionsFunc.bind(chart);
chart.x = function(_) {
if (!arguments.length) return getX;
getX = _;

@ -1,6 +1,6 @@
nv.models.linePlusBarWithFocusChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -43,7 +43,6 @@ nv.models.linePlusBarWithFocusChart = function() {
, y4
, noData = "No Data Available."
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush')
, transitionDuration = 0
;
lines
@ -108,7 +107,7 @@ nv.models.linePlusBarWithFocusChart = function() {
- margin.top - margin.bottom - height2,
availableHeight2 = height2 - margin2.top - margin2.bottom;
chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
chart.update = function() { chart(selection) };
chart.container = this;
@ -259,8 +258,8 @@ nv.models.linePlusBarWithFocusChart = function() {
g.select('.nv-context')
.attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')')
bars2Wrap.transition().call(bars2);
lines2Wrap.transition().call(lines2);
d3.transition(bars2Wrap).call(bars2);
d3.transition(lines2Wrap).call(lines2);
//------------------------------------------------------------
@ -311,7 +310,7 @@ nv.models.linePlusBarWithFocusChart = function() {
g.select('.nv-context .nv-x.nv-axis')
.attr('transform', 'translate(0,' + y3.range()[0] + ')');
g.select('.nv-context .nv-x.nv-axis').transition()
d3.transition(g.select('.nv-context .nv-x.nv-axis'))
.call(x2Axis);
@ -324,7 +323,7 @@ nv.models.linePlusBarWithFocusChart = function() {
.style('opacity', dataBars.length ? 1 : 0)
.attr('transform', 'translate(0,' + x2.range()[0] + ')');
g.select('.nv-context .nv-y1.nv-axis').transition()
d3.transition(g.select('.nv-context .nv-y1.nv-axis'))
.call(y3Axis);
@ -337,7 +336,7 @@ nv.models.linePlusBarWithFocusChart = function() {
.style('opacity', dataLines.length ? 1 : 0)
.attr('transform', 'translate(' + x2.range()[1] + ',0)');
g.select('.nv-context .nv-y2.nv-axis').transition()
d3.transition(g.select('.nv-context .nv-y2.nv-axis'))
.call(y4Axis);
//------------------------------------------------------------
@ -346,8 +345,18 @@ nv.models.linePlusBarWithFocusChart = function() {
// Event Handling/Dispatching (in chart's scope)
//------------------------------------------------------------
legend.dispatch.on('stateChange', function(newState) {
chart.update();
legend.dispatch.on('legendClick', function(d,i) {
d.disabled = !d.disabled;
if (!data.filter(function(d) { return !d.disabled }).length) {
data.map(function(d) {
d.disabled = false;
wrap.selectAll('.nv-series').classed('disabled', false);
return d;
});
}
selection.call(chart);
});
dispatch.on('tooltipShow', function(e) {
@ -468,7 +477,7 @@ nv.models.linePlusBarWithFocusChart = function() {
xAxis.domain([Math.ceil(extent[0]), Math.floor(extent[1])]);
g.select('.nv-x.nv-axis').transition().duration(transitionDuration)
d3.transition(g.select('.nv-x.nv-axis'))
.call(xAxis);
//------------------------------------------------------------
@ -476,8 +485,8 @@ nv.models.linePlusBarWithFocusChart = function() {
//------------------------------------------------------------
// Update Main (Focus) Bars and Lines
focusBarsWrap.transition().duration(transitionDuration).call(bars);
focusLinesWrap.transition().duration(transitionDuration).call(lines);
d3.transition(focusBarsWrap).call(bars);
d3.transition(focusLinesWrap).call(lines);
//------------------------------------------------------------
@ -507,9 +516,9 @@ nv.models.linePlusBarWithFocusChart = function() {
.style('opacity', dataLines.length ? 1 : 0)
.attr('transform', 'translate(' + x.range()[1] + ',0)');
g.select('.nv-focus .nv-y1.nv-axis').transition().duration(transitionDuration)
d3.transition(g.select('.nv-focus .nv-y1.nv-axis'))
.call(y1Axis);
g.select('.nv-focus .nv-y2.nv-axis').transition().duration(transitionDuration)
d3.transition(g.select('.nv-focus .nv-y2.nv-axis'))
.call(y2Axis);
}
@ -572,10 +581,8 @@ nv.models.linePlusBarWithFocusChart = function() {
d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate');
//TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc.
//d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
//d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
chart.options = nv.utils.optionsFunc.bind(chart);
chart.x = function(_) {
if (!arguments.length) return getX;
getX = _;

@ -1,6 +1,5 @@
nv.models.line = function() {
"use strict";
//Default Settings
var margin = {top: 0, right: 0, bottom: 0, left: 0},
width = 960,
@ -129,10 +128,8 @@ nv.models.line = function() {
chart.dispatch = scatter.dispatch;
d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius');
d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius');
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if (!arguments.length) return margin;
margin = _;

@ -1,6 +1,5 @@
nv.models.lineChart = function() {
"use strict";
var margin = {top: 30, right: 20, bottom: 50, left: 60},
color = nv.utils.defaultColor(),
width = null,
@ -26,7 +25,7 @@ nv.models.lineChart = function() {
xAxis = nv.models.axis().scale(x).orient('bottom').tickPadding(5),
yAxis = nv.models.axis().scale(y).orient('left'),
legend = nv.models.legend().height(30),
controls = nv.models.legend().height(30).updateState(false),
controls = nv.models.legend().height(30),
dispatch = d3.dispatch('tooltipShow', 'tooltipHide');
@ -56,8 +55,7 @@ nv.models.lineChart = function() {
availableHeight = (height || parseInt(container.style('height')) || 400)
- margin.top - margin.bottom;
chart.update = function() { container.transition().call(chart) };
chart.container = this; // I need a reference to the container in order to have outside code check if the chart is visible or not
//------------------------------------------------------------
// Display No Data message if there's nothing to show.
@ -209,13 +207,37 @@ nv.models.lineChart = function() {
pauseFisheye = false;
}
chart.update();
selection.transition().call(chart);
});
legend.dispatch.on('legendClick', function(d,i) {
d.disabled = !d.disabled;
if (!data.filter(function(d) { return !d.disabled }).length) {
data.map(function(d) {
d.disabled = false;
wrap.selectAll('.nv-series').classed('disabled', false);
return d;
});
}
selection.transition().call(chart);
});
/*
//
legend.dispatch.on('legendMouseover', function(d, i) {
d.hover = true;
selection.transition().call(chart)
});
legend.dispatch.on('stateChange', function(newState) {
chart.update();
legend.dispatch.on('legendMouseout', function(d, i) {
d.hover = false;
selection.transition().call(chart)
});
*/
lines.dispatch.on('elementMouseover.tooltip', function(e) {
e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
@ -230,6 +252,12 @@ nv.models.lineChart = function() {
});
//TODO: decide if this is a good idea, and if it should be in all models
chart.update = function() { chart(selection) };
chart.container = this; // I need a reference to the container in order to have outside code check if the chart is visible or not
return chart;
}
@ -239,10 +267,9 @@ nv.models.lineChart = function() {
chart.xAxis = xAxis;
chart.yAxis = yAxis;
d3.rebind(chart, lines, 'defined', 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate');
d3.rebind(chart, lines, 'defined', 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate');
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if (!arguments.length) return margin;
margin = _;

@ -1,5 +1,6 @@
nv.models.lineWithFocusChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -33,7 +34,6 @@ nv.models.lineWithFocusChart = function() {
}
, noData = "No Data Available."
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush')
, transitionDuration = 250
;
lines
@ -87,7 +87,7 @@ nv.models.lineWithFocusChart = function() {
- margin.top - margin.bottom - height2,
availableHeight2 = height2 - margin2.top - margin2.bottom;
chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
chart.update = function() { chart(selection) };
chart.container = this;
@ -249,13 +249,7 @@ nv.models.lineWithFocusChart = function() {
brush
.x(x2)
.on('brush', function() {
//When brushing, turn off transitions because chart needs to change immediately.
var oldTransition = chart.transitionDuration();
chart.transitionDuration(0);
onBrush();
chart.transitionDuration(oldTransition);
});
.on('brush', onBrush);
if (brushExtent) brush.extent(brushExtent);
@ -277,7 +271,7 @@ nv.models.lineWithFocusChart = function() {
.attr('y', 0)
.attr('height', availableHeight2);
var gBrush = g.select('.nv-x.nv-brush')
gBrush = g.select('.nv-x.nv-brush')
.call(brush);
gBrush.selectAll('rect')
//.attr('y', -5)
@ -321,8 +315,18 @@ nv.models.lineWithFocusChart = function() {
// Event Handling/Dispatching (in chart's scope)
//------------------------------------------------------------
legend.dispatch.on('stateChange', function(newState) {
chart.update();
legend.dispatch.on('legendClick', function(d,i) {
d.disabled = !d.disabled;
if (!data.filter(function(d) { return !d.disabled }).length) {
data.map(function(d) {
d.disabled = false;
wrap.selectAll('.nv-series').classed('disabled', false);
return d;
});
}
selection.transition().call(chart);
});
dispatch.on('tooltipShow', function(e) {
@ -372,12 +376,8 @@ nv.models.lineWithFocusChart = function() {
function onBrush() {
brushExtent = brush.empty() ? null : brush.extent();
var extent = brush.empty() ? x2.domain() : brush.extent();
extent = brush.empty() ? x2.domain() : brush.extent();
//The brush extent cannot be less than one. If it is, don't update the line chart.
if (Math.abs(extent[0] - extent[1]) <= 1) {
return;
}
dispatch.brush({extent: extent, brush: brush});
@ -398,13 +398,13 @@ nv.models.lineWithFocusChart = function() {
}
})
);
focusLinesWrap.transition().duration(transitionDuration).call(lines);
d3.transition(focusLinesWrap).call(lines);
// Update Main (Focus) Axes
g.select('.nv-focus .nv-x.nv-axis').transition().duration(transitionDuration)
d3.transition(g.select('.nv-focus .nv-x.nv-axis'))
.call(xAxis);
g.select('.nv-focus .nv-y.nv-axis').transition().duration(transitionDuration)
d3.transition(g.select('.nv-focus .nv-y.nv-axis'))
.call(yAxis);
}
@ -451,10 +451,8 @@ nv.models.lineWithFocusChart = function() {
chart.x2Axis = x2Axis;
chart.y2Axis = y2Axis;
d3.rebind(chart, lines, 'defined', 'isArea', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
d3.rebind(chart, lines, 'defined', 'isArea', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
chart.options = nv.utils.optionsFunc.bind(chart);
chart.x = function(_) {
if (!arguments.length) return lines.x;
lines.x(_);
@ -554,18 +552,6 @@ nv.models.lineWithFocusChart = function() {
y2Axis.tickFormat(_);
return chart;
};
chart.brushExtent = function(_) {
if (!arguments.length) return brushExtent;
brushExtent = _;
return chart;
};
chart.transitionDuration = function(_) {
if (!arguments.length) return transitionDuration;
transitionDuration = _;
return chart;
};
//============================================================

@ -1,6 +1,6 @@
nv.models.multiBar = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -16,7 +16,6 @@ nv.models.multiBar = function() {
, forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
, clipEdge = true
, stacked = false
, stackOffset = 'zero' // options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function
, color = nv.utils.defaultColor()
, hideable = false
, barColor = null // adding the ability to set the color for each rather than the whole group
@ -24,9 +23,6 @@ nv.models.multiBar = function() {
, delay = 1200
, xDomain
, yDomain
, xRange
, yRange
, groupSpacing = 0.1
, dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
;
@ -61,17 +57,19 @@ nv.models.multiBar = function() {
if (stacked)
data = d3.layout.stack()
.offset(stackOffset)
.offset('zero')
.values(function(d){ return d.values })
.y(getY)
(!data.length && hideable ? hideable : data);
//add series index to each data point for reference
data.forEach(function(series, i) {
series.values.forEach(function(point) {
data = data.map(function(series, i) {
series.values = series.values.map(function(point) {
point.series = i;
return point;
});
return series;
});
@ -87,7 +85,7 @@ nv.models.multiBar = function() {
f.y1 = negBase;
negBase = negBase - f.size;
} else
{
{
f.y1 = f.size + posBase;
posBase = posBase + f.size;
}
@ -105,14 +103,15 @@ nv.models.multiBar = function() {
})
});
x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
.rangeBands(xRange || [0, availableWidth], groupSpacing);
x .domain(d3.merge(seriesData).map(function(d) { return d.x }))
.rangeBands([0, availableWidth], .1);
//y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y1 : 0) }).concat(forceY)))
y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 : d.y1 + d.y ) : d.y }).concat(forceY)))
.range(yRange || [availableHeight, 0]);
.range([availableHeight, 0]);
// If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true;
if (x.domain()[0] === x.domain()[1])
x.domain()[0] ?
x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
@ -159,16 +158,16 @@ nv.models.multiBar = function() {
var groups = wrap.select('.nv-groups').selectAll('.nv-group')
.data(function(d) { return d }, function(d,i) { return i });
.data(function(d) { return d }, function(d) { return d.key });
groups.enter().append('g')
.style('stroke-opacity', 1e-6)
.style('fill-opacity', 1e-6);
groups.exit()
.transition()
.selectAll('rect.nv-bar')
.delay(function(d,i) {
return i * delay/ data[0].values.length;
})
.transition()
.delay(function(d,i) { return i * delay/ data[0].values.length })
.attr('y', function(d) { return stacked ? y0(d.y0) : y0(0) })
.attr('height', 0)
.remove();
@ -177,8 +176,7 @@ nv.models.multiBar = function() {
.classed('hover', function(d) { return d.hover })
.style('fill', function(d,i){ return color(d, i) })
.style('stroke', function(d,i){ return color(d, i) });
groups
.transition()
d3.transition(groups)
.style('stroke-opacity', 1)
.style('fill-opacity', .75);
@ -196,9 +194,7 @@ nv.models.multiBar = function() {
})
.attr('y', function(d) { return y0(stacked ? d.y0 : 0) })
.attr('height', 0)
.attr('width', x.rangeBand() / (stacked ? 1 : data.length) )
.attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; })
;
.attr('width', x.rangeBand() / (stacked ? 1 : data.length) );
bars
.style('fill', function(d,i,j){ return color(d, j, i); })
.style('stroke', function(d,i,j){ return color(d, j, i); })
@ -251,23 +247,23 @@ nv.models.multiBar = function() {
});
bars
.attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
.transition()
.attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; })
if (barColor) {
if (!disabled) disabled = data.map(function() { return true });
bars
//.style('fill', barColor)
//.style('stroke', barColor)
//.style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); })
//.style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); })
.style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); })
.style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); });
}
if (stacked)
bars.transition()
.delay(function(d,i) {
return i * delay / data[0].values.length;
})
bars.transition()
.delay(function(d,i) { return i * delay / data[0].values.length })
.attr('y', function(d,i) {
return y((stacked ? d.y1 : 0));
@ -275,30 +271,33 @@ nv.models.multiBar = function() {
.attr('height', function(d,i) {
return Math.max(Math.abs(y(d.y + (stacked ? d.y0 : 0)) - y((stacked ? d.y0 : 0))),1);
})
.attr('x', function(d,i) {
.each('end', function() {
d3.transition(d3.select(this))
.attr('x', function(d,i) {
return stacked ? 0 : (d.series * x.rangeBand() / data.length )
})
.attr('width', x.rangeBand() / (stacked ? 1 : data.length) );
})
.attr('width', x.rangeBand() / (stacked ? 1 : data.length) );
else
bars.transition()
.delay(function(d,i) {
return i * delay/ data[0].values.length;
})
d3.transition(bars)
.delay(function(d,i) { return i * delay/ data[0].values.length })
.attr('x', function(d,i) {
return d.series * x.rangeBand() / data.length
})
.attr('width', x.rangeBand() / data.length)
.attr('y', function(d,i) {
return getY(d,i) < 0 ?
y(0) :
y(0) - y(getY(d,i)) < 1 ?
y(0) - 1 :
y(getY(d,i)) || 0;
.each('end', function() {
d3.transition(d3.select(this))
.attr('y', function(d,i) {
return getY(d,i) < 0 ?
y(0) :
y(0) - y(getY(d,i)) < 1 ?
y(0) - 1 :
y(getY(d,i)) || 0;
})
.attr('height', function(d,i) {
return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) || 0;
});
})
.attr('height', function(d,i) {
return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) || 0;
});
//store old scales for use in transitions on update
@ -317,8 +316,6 @@ nv.models.multiBar = function() {
chart.dispatch = dispatch;
chart.options = nv.utils.optionsFunc.bind(chart);
chart.x = function(_) {
if (!arguments.length) return getX;
getX = _;
@ -376,18 +373,6 @@ nv.models.multiBar = function() {
return chart;
};
chart.xRange = function(_) {
if (!arguments.length) return xRange;
xRange = _;
return chart;
};
chart.yRange = function(_) {
if (!arguments.length) return yRange;
yRange = _;
return chart;
};
chart.forceY = function(_) {
if (!arguments.length) return forceY;
forceY = _;
@ -400,12 +385,6 @@ nv.models.multiBar = function() {
return chart;
};
chart.stackOffset = function(_) {
if (!arguments.length) return stackOffset;
stackOffset = _;
return chart;
};
chart.clipEdge = function(_) {
if (!arguments.length) return clipEdge;
clipEdge = _;
@ -448,12 +427,6 @@ nv.models.multiBar = function() {
return chart;
};
chart.groupSpacing = function(_) {
if (!arguments.length) return groupSpacing;
groupSpacing = _;
return chart;
};
//============================================================

@ -1,6 +1,6 @@
nv.models.multiBarChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -12,17 +12,13 @@ nv.models.multiBarChart = function() {
, controls = nv.models.legend()
;
var margin = {top: 30, right: 20, bottom: 50, left: 60}
var margin = {top: 30, right: 20, bottom: 30, left: 60}
, width = null
, height = null
, color = nv.utils.defaultColor()
, showControls = true
, showLegend = true
, showXAxis = true
, showYAxis = true
, rightAlignYAxis = false
, reduceXTicks = true // if false a tick will show for every data point
, staggerLabels = false
, rotateLabels = 0
, tooltips = true
, tooltip = function(key, x, y, e, graph) {
@ -36,7 +32,6 @@ nv.models.multiBarChart = function() {
, noData = "No Data Available."
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
, controlWidth = function() { return showControls ? 180 : 0 }
, transitionDuration = 250
;
multibar
@ -45,16 +40,15 @@ nv.models.multiBarChart = function() {
xAxis
.orient('bottom')
.tickPadding(7)
.highlightZero(true)
.highlightZero(false)
.showMaxMin(false)
.tickFormat(function(d) { return d })
;
yAxis
.orient((rightAlignYAxis) ? 'right' : 'left')
.orient('left')
.tickFormat(d3.format(',.1f'))
;
controls.updateState(false);
//============================================================
@ -85,7 +79,7 @@ nv.models.multiBarChart = function() {
availableHeight = (height || parseInt(container.style('height')) || 400)
- margin.top - margin.bottom;
chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
chart.update = function() { selection.transition().call(chart) };
chart.container = this;
//set state.disabled
@ -199,10 +193,6 @@ nv.models.multiBarChart = function() {
wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
if (rightAlignYAxis) {
g.select(".nv-y.nv-axis")
.attr("transform", "translate(" + availableWidth + ",0)");
}
//------------------------------------------------------------
// Main Chart Component(s)
@ -219,7 +209,7 @@ nv.models.multiBarChart = function() {
var barsWrap = g.select('.nv-barsWrap')
.datum(data.filter(function(d) { return !d.disabled }))
barsWrap.transition().call(multibar);
d3.transition(barsWrap).call(multibar);
//------------------------------------------------------------
@ -227,72 +217,46 @@ nv.models.multiBarChart = function() {
//------------------------------------------------------------
// Setup Axes
if (showXAxis) {
xAxis
.scale(x)
.ticks( availableWidth / 100 )
.tickSize(-availableHeight, 0);
g.select('.nv-x.nv-axis')
.attr('transform', 'translate(0,' + y.range()[0] + ')');
g.select('.nv-x.nv-axis').transition()
.call(xAxis);
var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g');
xTicks
.selectAll('line, text')
.style('opacity', 1)
if (staggerLabels) {
var getTranslate = function(x,y) {
return "translate(" + x + "," + y + ")";
};
var staggerUp = 5, staggerDown = 17; //pixels to stagger by
// Issue #140
xTicks
.selectAll("text")
.attr('transform', function(d,i,j) {
return getTranslate(0, (j % 2 == 0 ? staggerUp : staggerDown));
});
var totalInBetweenTicks = d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;
g.selectAll(".nv-x.nv-axis .nv-axisMaxMin text")
.attr("transform", function(d,i) {
return getTranslate(0, (i === 0 || totalInBetweenTicks % 2 !== 0) ? staggerDown : staggerUp);
});
}
if (reduceXTicks)
xTicks
.filter(function(d,i) {
return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0;
})
.selectAll('text, line')
.style('opacity', 0);
if(rotateLabels)
xTicks
.selectAll('.tick text')
.attr('transform', 'rotate(' + rotateLabels + ' 0,0)')
.style('text-anchor', rotateLabels > 0 ? 'start' : 'end');
g.select('.nv-x.nv-axis').selectAll('g.nv-axisMaxMin text')
.style('opacity', 1);
}
if (showYAxis) {
yAxis
.scale(y)
.ticks( availableHeight / 36 )
.tickSize( -availableWidth, 0);
g.select('.nv-y.nv-axis').transition()
.call(yAxis);
}
xAxis
.scale(x)
.ticks( availableWidth / 100 )
.tickSize(-availableHeight, 0);
g.select('.nv-x.nv-axis')
.attr('transform', 'translate(0,' + y.range()[0] + ')');
d3.transition(g.select('.nv-x.nv-axis'))
.call(xAxis);
var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g');
xTicks
.selectAll('line, text')
.style('opacity', 1)
if (reduceXTicks)
xTicks
.filter(function(d,i) {
return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0;
})
.selectAll('text, line')
.style('opacity', 0);
if(rotateLabels)
xTicks
.selectAll('text')
.attr('transform', 'rotate(' + rotateLabels + ' 0,0)')
.attr('text-anchor', rotateLabels > 0 ? 'start' : 'end');
g.select('.nv-x.nv-axis').selectAll('g.nv-axisMaxMin text')
.style('opacity', 1);
yAxis
.scale(y)
.ticks( availableHeight / 36 )
.tickSize( -availableWidth, 0);
d3.transition(g.select('.nv-y.nv-axis'))
.call(yAxis);
//------------------------------------------------------------
@ -302,10 +266,21 @@ nv.models.multiBarChart = function() {
// Event Handling/Dispatching (in chart's scope)
//------------------------------------------------------------
legend.dispatch.on('stateChange', function(newState) {
state = newState;
legend.dispatch.on('legendClick', function(d,i) {
d.disabled = !d.disabled;
if (!data.filter(function(d) { return !d.disabled }).length) {
data.map(function(d) {
d.disabled = false;
wrap.selectAll('.nv-series').classed('disabled', false);
return d;
});
}
state.disabled = data.map(function(d) { return !!d.disabled });
dispatch.stateChange(state);
chart.update();
selection.transition().call(chart);
});
controls.dispatch.on('legendClick', function(d,i) {
@ -328,7 +303,7 @@ nv.models.multiBarChart = function() {
state.stacked = multibar.stacked();
dispatch.stateChange(state);
chart.update();
selection.transition().call(chart);
});
dispatch.on('tooltipShow', function(e) {
@ -351,7 +326,7 @@ nv.models.multiBarChart = function() {
state.stacked = e.stacked;
}
chart.update();
selection.call(chart);
});
//============================================================
@ -393,11 +368,8 @@ nv.models.multiBarChart = function() {
chart.xAxis = xAxis;
chart.yAxis = yAxis;
d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge',
'id', 'stacked', 'stackOffset', 'delay', 'barColor','groupSpacing');
d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'forceX', 'forceY', 'clipEdge', 'id', 'stacked', 'delay', 'barColor');
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
@ -438,25 +410,6 @@ nv.models.multiBarChart = function() {
return chart;
};
chart.showXAxis = function(_) {
if (!arguments.length) return showXAxis;
showXAxis = _;
return chart;
};
chart.showYAxis = function(_) {
if (!arguments.length) return showYAxis;
showYAxis = _;
return chart;
};
chart.rightAlignYAxis = function(_) {
if(!arguments.length) return rightAlignYAxis;
rightAlignYAxis = _;
yAxis.orient( (_) ? 'right' : 'left');
return chart;
};
chart.reduceXTicks= function(_) {
if (!arguments.length) return reduceXTicks;
reduceXTicks = _;
@ -469,12 +422,6 @@ nv.models.multiBarChart = function() {
return chart;
}
chart.staggerLabels = function(_) {
if (!arguments.length) return staggerLabels;
staggerLabels = _;
return chart;
};
chart.tooltip = function(_) {
if (!arguments.length) return tooltip;
tooltip = _;
@ -511,12 +458,6 @@ nv.models.multiBarChart = function() {
return chart;
};
chart.transitionDuration = function(_) {
if (!arguments.length) return transitionDuration;
transitionDuration = _;
return chart;
};
//============================================================

@ -1,5 +1,6 @@
nv.models.multiBarHorizontal = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -18,14 +19,11 @@ nv.models.multiBarHorizontal = function() {
, disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled
, stacked = false
, showValues = false
, showBarLabels = false
, valuePadding = 60
, valueFormat = d3.format(',.2f')
, delay = 1200
, xDomain
, yDomain
, xRange
, yRange
, dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
;
@ -58,10 +56,12 @@ nv.models.multiBarHorizontal = function() {
//add series index to each data point for reference
data.forEach(function(series, i) {
series.values.forEach(function(point) {
data = data.map(function(series, i) {
series.values = series.values.map(function(point) {
point.series = i;
return point;
});
return series;
});
@ -78,7 +78,7 @@ nv.models.multiBarHorizontal = function() {
f.y1 = negBase - f.size;
negBase = negBase - f.size;
} else
{
{
f.y1 = posBase;
posBase = posBase + f.size;
}
@ -99,15 +99,15 @@ nv.models.multiBarHorizontal = function() {
});
x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x }))
.rangeBands(xRange || [0, availableHeight], .35);
.rangeBands([0, availableHeight], .1);
//y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y0 : 0) }).concat(forceY)))
y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 + d.y : d.y1 ) : d.y }).concat(forceY)))
if (showValues && !stacked)
y.range(yRange || [(y.domain()[0] < 0 ? valuePadding : 0), availableWidth - (y.domain()[1] > 0 ? valuePadding : 0) ]);
y.range([(y.domain()[0] < 0 ? valuePadding : 0), availableWidth - (y.domain()[1] > 0 ? valuePadding : 0) ]);
else
y.range(yRange || [0, availableWidth]);
y.range([0, availableWidth]);
x0 = x0 || x;
y0 = y0 || d3.scale.linear().domain(y.domain()).range([y(0),y(0)]);
@ -133,11 +133,11 @@ nv.models.multiBarHorizontal = function() {
var groups = wrap.select('.nv-groups').selectAll('.nv-group')
.data(function(d) { return d }, function(d,i) { return i });
.data(function(d) { return d }, function(d) { return d.key });
groups.enter().append('g')
.style('stroke-opacity', 1e-6)
.style('fill-opacity', 1e-6);
groups.exit().transition()
d3.transition(groups.exit())
.style('stroke-opacity', 1e-6)
.style('fill-opacity', 1e-6)
.remove();
@ -146,7 +146,7 @@ nv.models.multiBarHorizontal = function() {
.classed('hover', function(d) { return d.hover })
.style('fill', function(d,i){ return color(d, i) })
.style('stroke', function(d,i){ return color(d, i) });
groups.transition()
d3.transition(groups)
.style('stroke-opacity', 1)
.style('fill-opacity', .75);
@ -224,41 +224,35 @@ nv.models.multiBarHorizontal = function() {
.attr('y', x.rangeBand() / (data.length * 2))
.attr('dy', '.32em')
.text(function(d,i) { return valueFormat(getY(d,i)) })
bars.transition()
d3.transition(bars)
//.delay(function(d,i) { return i * delay / data[0].values.length })
.select('text')
.attr('x', function(d,i) { return getY(d,i) < 0 ? -4 : y(getY(d,i)) - y(0) + 4 })
} else {
//bars.selectAll('text').remove();
bars.selectAll('text').text('');
}
if (showBarLabels && !stacked) {
barsEnter.append('text').classed('nv-bar-label',true);
bars.select('text.nv-bar-label')
.attr('text-anchor', function(d,i) { return getY(d,i) < 0 ? 'start' : 'end' })
.attr('y', x.rangeBand() / (data.length * 2))
.attr('dy', '.32em')
.text(function(d,i) { return getX(d,i) });
bars.transition()
.select('text.nv-bar-label')
.attr('x', function(d,i) { return getY(d,i) < 0 ? y(0) - y(getY(d,i)) + 4 : -4 });
}
else {
bars.selectAll('text.nv-bar-label').text('');
}
bars
.attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
if (barColor) {
if (!disabled) disabled = data.map(function() { return true });
bars
//.style('fill', barColor)
//.style('stroke', barColor)
//.style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); })
//.style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); })
.style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); })
.style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); });
}
if (stacked)
bars.transition()
d3.transition(bars)
//.delay(function(d,i) { return i * delay / data[0].values.length })
.attr('transform', function(d,i) {
//return 'translate(' + y(d.y0) + ',0)'
//return 'translate(' + y(d.y0) + ',' + x(getX(d,i)) + ')'
return 'translate(' + y(d.y1) + ',' + x(getX(d,i)) + ')'
})
.select('rect')
@ -267,10 +261,11 @@ nv.models.multiBarHorizontal = function() {
})
.attr('height', x.rangeBand() );
else
bars.transition()
d3.transition(bars)
//.delay(function(d,i) { return i * delay / data[0].values.length })
.attr('transform', function(d,i) {
//TODO: stacked must be all positive or all negative, not both?
return 'translate(' +
return 'translate(' +
(getY(d,i) < 0 ? y(getY(d,i)) : y(0))
+ ',' +
(d.series * x.rangeBand() / data.length
@ -301,8 +296,6 @@ nv.models.multiBarHorizontal = function() {
chart.dispatch = dispatch;
chart.options = nv.utils.optionsFunc.bind(chart);
chart.x = function(_) {
if (!arguments.length) return getX;
getX = _;
@ -360,18 +353,6 @@ nv.models.multiBarHorizontal = function() {
return chart;
};
chart.xRange = function(_) {
if (!arguments.length) return xRange;
xRange = _;
return chart;
};
chart.yRange = function(_) {
if (!arguments.length) return yRange;
yRange = _;
return chart;
};
chart.forceY = function(_) {
if (!arguments.length) return forceY;
forceY = _;
@ -420,13 +401,6 @@ nv.models.multiBarHorizontal = function() {
return chart;
};
chart.showBarLabels = function(_) {
if (!arguments.length) return showBarLabels;
showBarLabels = _;
return chart;
};
chart.valueFormat= function(_) {
if (!arguments.length) return valueFormat;
valueFormat = _;

@ -1,6 +1,6 @@
nv.models.multiBarHorizontalChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -18,8 +18,6 @@ nv.models.multiBarHorizontalChart = function() {
, color = nv.utils.defaultColor()
, showControls = true
, showLegend = true
, showXAxis = true
, showYAxis = true
, stacked = false
, tooltips = true
, tooltip = function(key, x, y, e, graph) {
@ -33,7 +31,6 @@ nv.models.multiBarHorizontalChart = function() {
, noData = 'No Data Available.'
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
, controlWidth = function() { return showControls ? 180 : 0 }
, transitionDuration = 250
;
multibar
@ -51,7 +48,6 @@ nv.models.multiBarHorizontalChart = function() {
.tickFormat(d3.format(',.1f'))
;
controls.updateState(false);
//============================================================
@ -82,7 +78,7 @@ nv.models.multiBarHorizontalChart = function() {
availableHeight = (height || parseInt(container.style('height')) || 400)
- margin.top - margin.bottom;
chart.update = function() { container.transition().duration(transitionDuration).call(chart) };
chart.update = function() { selection.transition().call(chart) };
chart.container = this;
//set state.disabled
@ -140,9 +136,7 @@ nv.models.multiBarHorizontalChart = function() {
var g = wrap.select('g');
gEnter.append('g').attr('class', 'nv-x nv-axis');
gEnter.append('g').attr('class', 'nv-y nv-axis')
.append('g').attr('class', 'nv-zeroLine')
.append('line');
gEnter.append('g').attr('class', 'nv-y nv-axis');
gEnter.append('g').attr('class', 'nv-barsWrap');
gEnter.append('g').attr('class', 'nv-legendWrap');
gEnter.append('g').attr('class', 'nv-controlsWrap');
@ -215,7 +209,7 @@ nv.models.multiBarHorizontalChart = function() {
var barsWrap = g.select('.nv-barsWrap')
.datum(data.filter(function(d) { return !d.disabled }))
barsWrap.transition().call(multibar);
d3.transition(barsWrap).call(multibar);
//------------------------------------------------------------
@ -223,40 +217,30 @@ nv.models.multiBarHorizontalChart = function() {
//------------------------------------------------------------
// Setup Axes
if (showXAxis) {
xAxis
.scale(x)
.ticks( availableHeight / 24 )
.tickSize(-availableWidth, 0);
xAxis
.scale(x)
.ticks( availableHeight / 24 )
.tickSize(-availableWidth, 0);
g.select('.nv-x.nv-axis').transition()
.call(xAxis);
d3.transition(g.select('.nv-x.nv-axis'))
.call(xAxis);
var xTicks = g.select('.nv-x.nv-axis').selectAll('g');
var xTicks = g.select('.nv-x.nv-axis').selectAll('g');
xTicks
.selectAll('line, text');
}
xTicks
.selectAll('line, text')
.style('opacity', 1)
if (showYAxis) {
yAxis
.scale(y)
.ticks( availableWidth / 100 )
.tickSize( -availableHeight, 0);
g.select('.nv-y.nv-axis')
.attr('transform', 'translate(0,' + availableHeight + ')');
g.select('.nv-y.nv-axis').transition()
.call(yAxis);
}
yAxis
.scale(y)
.ticks( availableWidth / 100 )
.tickSize( -availableHeight, 0);
// Zero line
g.select(".nv-zeroLine line")
.attr("x1", y(0))
.attr("x2", y(0))
.attr("y1", 0)
.attr("y2", -availableHeight)
;
g.select('.nv-y.nv-axis')
.attr('transform', 'translate(0,' + availableHeight + ')');
d3.transition(g.select('.nv-y.nv-axis'))
.call(yAxis);
//------------------------------------------------------------
@ -266,10 +250,21 @@ nv.models.multiBarHorizontalChart = function() {
// Event Handling/Dispatching (in chart's scope)
//------------------------------------------------------------
legend.dispatch.on('stateChange', function(newState) {
state = newState;
legend.dispatch.on('legendClick', function(d,i) {
d.disabled = !d.disabled;
if (!data.filter(function(d) { return !d.disabled }).length) {
data.map(function(d) {
d.disabled = false;
wrap.selectAll('.nv-series').classed('disabled', false);
return d;
});
}
state.disabled = data.map(function(d) { return !!d.disabled });
dispatch.stateChange(state);
chart.update();
selection.transition().call(chart);
});
controls.dispatch.on('legendClick', function(d,i) {
@ -292,7 +287,7 @@ nv.models.multiBarHorizontalChart = function() {
state.stacked = multibar.stacked();
dispatch.stateChange(state);
chart.update();
selection.transition().call(chart);
});
dispatch.on('tooltipShow', function(e) {
@ -315,7 +310,7 @@ nv.models.multiBarHorizontalChart = function() {
state.stacked = e.stacked;
}
chart.update();
selection.call(chart);
});
//============================================================
@ -356,10 +351,7 @@ nv.models.multiBarHorizontalChart = function() {
chart.xAxis = xAxis;
chart.yAxis = yAxis;
d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY',
'clipEdge', 'id', 'delay', 'showValues','showBarLabels', 'valueFormat', 'stacked', 'barColor');
chart.options = nv.utils.optionsFunc.bind(chart);
d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'forceX', 'forceY', 'clipEdge', 'id', 'delay', 'showValues', 'valueFormat', 'stacked', 'barColor');
chart.margin = function(_) {
if (!arguments.length) return margin;
@ -401,18 +393,6 @@ nv.models.multiBarHorizontalChart = function() {
return chart;
};
chart.showXAxis = function(_) {
if (!arguments.length) return showXAxis;
showXAxis = _;
return chart;
};
chart.showYAxis = function(_) {
if (!arguments.length) return showYAxis;
showYAxis = _;
return chart;
};
chart.tooltip = function(_) {
if (!arguments.length) return tooltip;
tooltip = _;
@ -449,11 +429,6 @@ nv.models.multiBarHorizontalChart = function() {
return chart;
};
chart.transitionDuration = function(_) {
if (!arguments.length) return transitionDuration;
transitionDuration = _;
return chart;
};
//============================================================

@ -1,5 +1,5 @@
nv.models.multiBarTimeSeries = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -19,8 +19,6 @@ nv.models.multiBarTimeSeries = function() {
, delay = 1200
, xDomain
, yDomain
, xRange
, yRange
, dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
;
@ -52,10 +50,12 @@ nv.models.multiBarTimeSeries = function() {
//add series index to each data point for reference
data.forEach(function(series, i) {
series.values.forEach(function(point) {
data = data.map(function(series, i) {
series.values = series.values.map(function(point) {
point.series = i;
return point;
});
return series;
});
//------------------------------------------------------------
@ -69,14 +69,15 @@ nv.models.multiBarTimeSeries = function() {
})
});
x .domain(xDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.x })))
.range(xRange || [0, availableWidth]);
x .domain(d3.extent(d3.merge(seriesData).map(function(d) { return d.x })))
.range([0, availableWidth]);
y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y0 : 0) }).concat(forceY)))
.range(yRange || [availableHeight, 0]);
.range([availableHeight, 0]);
// If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true;
if (x.domain()[0] === x.domain()[1])
x.domain()[0] ?
x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
@ -154,10 +155,10 @@ nv.models.multiBarTimeSeries = function() {
for(var ei=0; ei<seriesData.length; ei+=1) {
maxElements = Math.max(seriesData[ei].length, maxElements);
}
var bandWidth = (availableWidth / maxElements)-0.1;
var barWidth = bandWidth / data.length;
var barsEnter = bars.enter().append('rect')
.attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'})
.attr('x', function(d,i,j) {
@ -269,8 +270,6 @@ nv.models.multiBarTimeSeries = function() {
chart.dispatch = dispatch;
chart.options = nv.utils.optionsFunc.bind(chart);
chart.x = function(_) {
if (!arguments.length) return getX;
getX = _;
@ -328,18 +327,6 @@ nv.models.multiBarTimeSeries = function() {
return chart;
};
chart.xRange = function(_) {
if (!arguments.length) return xRange;
xRange = _;
return chart;
};
chart.yRange = function(_) {
if (!arguments.length) return yRange;
yRange = _;
return chart;
};
chart.forceY = function(_) {
if (!arguments.length) return forceY;
forceY = _;

@ -1,5 +1,5 @@
nv.models.multiBarTimeSeriesChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -317,10 +317,8 @@ nv.models.multiBarTimeSeriesChart = function() {
chart.xAxis = xAxis;
chart.yAxis = yAxis;
d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge', 'id', 'stacked', 'delay');
d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'forceX', 'forceY', 'clipEdge', 'id', 'stacked', 'delay');
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;

@ -1,5 +1,5 @@
nv.models.multiChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -14,11 +14,7 @@ nv.models.multiChart = function() {
return '<h3>' + key + '</h3>' +
'<p>' + y + ' at ' + x + '</p>'
},
x,
y,
yDomain1,
yDomain2
; //can be accessed via chart.lines.[x/y]Scale()
x, y; //can be accessed via chart.lines.[x/y]Scale()
//============================================================
// Private Variables
@ -59,9 +55,6 @@ nv.models.multiChart = function() {
var container = d3.select(this),
that = this;
chart.update = function() { container.transition().call(chart); };
chart.container = this;
var availableWidth = (width || parseInt(container.style('width')) || 960)
- margin.left - margin.right,
availableHeight = (height || parseInt(container.style('height')) || 400)
@ -197,10 +190,10 @@ nv.models.multiChart = function() {
return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}})
}).concat([{x:0, y:0}]) : []
yScale1 .domain(yDomain1 || d3.extent(d3.merge(series1).concat(extraValue1), function(d) { return d.y } ))
yScale1 .domain(d3.extent(d3.merge(series1).concat(extraValue1), function(d) { return d.y } ))
.range([0, availableHeight])
yScale2 .domain(yDomain2 || d3.extent(d3.merge(series2).concat(extraValue2), function(d) { return d.y } ))
yScale2 .domain(d3.extent(d3.merge(series2).concat(extraValue2), function(d) { return d.y } ))
.range([0, availableHeight])
lines1.yDomain(yScale1.domain())
@ -250,16 +243,28 @@ nv.models.multiChart = function() {
.style('opacity', series2.length ? 1 : 0)
.attr('transform', 'translate(' + x.range()[1] + ',0)');
legend.dispatch.on('stateChange', function(newState) {
chart.update();
legend.dispatch.on('legendClick', function(d,i) {
d.disabled = !d.disabled;
if (!data.filter(function(d) { return !d.disabled }).length) {
data.map(function(d) {
d.disabled = false;
wrap.selectAll('.series').classed('disabled', false);
return d;
});
}
selection.transition().call(chart);
});
dispatch.on('tooltipShow', function(e) {
if (tooltips) showTooltip(e, that.parentNode);
});
});
chart.update = function() { chart(selection) };
chart.container = this;
return chart;
}
@ -374,7 +379,6 @@ nv.models.multiChart = function() {
chart.xAxis = xAxis;
chart.yAxis1 = yAxis1;
chart.yAxis2 = yAxis2;
chart.options = nv.utils.optionsFunc.bind(chart);
chart.x = function(_) {
if (!arguments.length) return getX;
@ -392,18 +396,6 @@ nv.models.multiChart = function() {
return chart;
};
chart.yDomain1 = function(_) {
if (!arguments.length) return yDomain1;
yDomain1 = _;
return chart;
};
chart.yDomain2 = function(_) {
if (!arguments.length) return yDomain2;
yDomain2 = _;
return chart;
};
chart.margin = function(_) {
if (!arguments.length) return margin;
margin = _;

@ -1,6 +1,6 @@
nv.models.ohlcBar = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -24,8 +24,6 @@ nv.models.ohlcBar = function() {
, color = nv.utils.defaultColor()
, xDomain
, yDomain
, xRange
, yRange
, dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout')
;
@ -53,17 +51,18 @@ nv.models.ohlcBar = function() {
x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) ));
if (padData)
x.range(xRange || [availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
else
x.range(xRange || [0, availableWidth]);
x.range([0, availableWidth]);
y .domain(yDomain || [
d3.min(data[0].values.map(getLow).concat(forceY)),
d3.max(data[0].values.map(getHigh).concat(forceY))
])
.range(yRange || [availableHeight, 0]);
.range([availableHeight, 0]);
// If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point
if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true;
if (x.domain()[0] === x.domain()[1])
x.domain()[0] ?
x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01])
@ -242,8 +241,6 @@ nv.models.ohlcBar = function() {
chart.dispatch = dispatch;
chart.options = nv.utils.optionsFunc.bind(chart);
chart.x = function(_) {
if (!arguments.length) return getX;
getX = _;
@ -325,18 +322,6 @@ nv.models.ohlcBar = function() {
return chart;
};
chart.xRange = function(_) {
if (!arguments.length) return xRange;
xRange = _;
return chart;
};
chart.yRange = function(_) {
if (!arguments.length) return yRange;
yRange = _;
return chart;
};
chart.forceX = function(_) {
if (!arguments.length) return forceX;
forceX = _;

@ -3,7 +3,7 @@
// http://bl.ocks.org/jasondavies/1341281
nv.models.parallelCoordinates = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -177,8 +177,7 @@ nv.models.parallelCoordinates = function() {
chart.dispatch = dispatch;
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;

@ -1,5 +1,5 @@
nv.models.pie = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -7,6 +7,7 @@ nv.models.pie = function() {
var margin = {top: 0, right: 0, bottom: 0, left: 0}
, width = 500
, height = 500
, getValues = function(d) { return d.values }
, getX = function(d) { return d.x }
, getY = function(d) { return d.y }
, getDescription = function(d) { return d.description }
@ -16,7 +17,6 @@ nv.models.pie = function() {
, showLabels = true
, pieLabelsOutside = true
, donutLabelsOutside = false
, labelType = "key"
, labelThreshold = .02 //if slice percentage is under this, don't show label
, donut = false
, labelSunbeamLayout = false
@ -42,17 +42,15 @@ nv.models.pie = function() {
// Setup containers and skeleton of chart
//var wrap = container.selectAll('.nv-wrap.nv-pie').data([data]);
var wrap = container.selectAll('.nv-wrap.nv-pie').data(data);
var wrap = container.selectAll('.nv-wrap.nv-pie').data([getValues(data[0])]);
var wrapEnter = wrap.enter().append('g').attr('class','nvd3 nv-wrap nv-pie nv-chart-' + id);
var gEnter = wrapEnter.append('g');
var g = wrap.select('g');
gEnter.append('g').attr('class', 'nv-pie');
gEnter.append('g').attr('class', 'nv-pieLabels');
wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
g.select('.nv-pie').attr('transform', 'translate(' + availableWidth / 2 + ',' + availableHeight / 2 + ')');
g.select('.nv-pieLabels').attr('transform', 'translate(' + availableWidth / 2 + ',' + availableHeight / 2 + ')');
//------------------------------------------------------------
@ -83,11 +81,7 @@ nv.models.pie = function() {
var slices = wrap.select('.nv-pie').selectAll('.nv-slice')
.data(pie);
var pieLabels = wrap.select('.nv-pieLabels').selectAll('.nv-label')
.data(pie);
slices.exit().remove();
pieLabels.exit().remove();
var ae = slices.enter().append('g')
.attr('class', 'nv-slice')
@ -143,102 +137,92 @@ nv.models.pie = function() {
.each(function(d) { this._current = d; });
//.attr('d', arc);
slices.select('path')
.transition()
d3.transition(slices.select('path'))
.attr('d', arc)
.attrTween('d', arcTween);
if (showLabels) {
// This does the normal label
var labelsArc = d3.svg.arc().innerRadius(0);
if (pieLabelsOutside){ labelsArc = arc; }
if (donutLabelsOutside) { labelsArc = d3.svg.arc().outerRadius(arc.outerRadius()); }
pieLabels.enter().append("g").classed("nv-label",true)
.each(function(d,i) {
var group = d3.select(this);
group
.attr('transform', function(d) {
if (labelSunbeamLayout) {
d.outerRadius = arcRadius + 10; // Set Outer Coordinate
d.innerRadius = arcRadius + 15; // Set Inner Coordinate
var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
if ((d.startAngle+d.endAngle)/2 < Math.PI) {
rotateAngle -= 90;
} else {
rotateAngle += 90;
}
return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
ae.append("g").classed("nv-label", true)
.each(function(d, i) {
var group = d3.select(this);
group
.attr('transform', function(d) {
if (labelSunbeamLayout) {
d.outerRadius = arcRadius + 10; // Set Outer Coordinate
d.innerRadius = arcRadius + 15; // Set Inner Coordinate
var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
if ((d.startAngle+d.endAngle)/2 < Math.PI) {
rotateAngle -= 90;
} else {
d.outerRadius = radius + 10; // Set Outer Coordinate
d.innerRadius = radius + 15; // Set Inner Coordinate
return 'translate(' + labelsArc.centroid(d) + ')'
rotateAngle += 90;
}
});
return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
} else {
d.outerRadius = radius + 10; // Set Outer Coordinate
d.innerRadius = radius + 15; // Set Inner Coordinate
return 'translate(' + labelsArc.centroid(d) + ')'
}
});
group.append('rect')
.style('stroke', '#fff')
.style('fill', '#fff')
.attr("rx", 3)
.attr("ry", 3);
group.append('text')
.style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned
.style('fill', '#000')
group.append('rect')
.style('stroke', '#fff')
.style('fill', '#fff')
.attr("rx", 3)
.attr("ry", 3);
group.append('text')
.style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned
.style('fill', '#000')
});
slices.select(".nv-label").transition()
.attr('transform', function(d) {
if (labelSunbeamLayout) {
d.outerRadius = arcRadius + 10; // Set Outer Coordinate
d.innerRadius = arcRadius + 15; // Set Inner Coordinate
var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
if ((d.startAngle+d.endAngle)/2 < Math.PI) {
rotateAngle -= 90;
} else {
rotateAngle += 90;
}
return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
} else {
d.outerRadius = radius + 10; // Set Outer Coordinate
d.innerRadius = radius + 15; // Set Inner Coordinate
return 'translate(' + labelsArc.centroid(d) + ')'
}
});
var labelLocationHash = {};
var avgHeight = 14;
var avgWidth = 140;
var createHashKey = function(coordinates) {
slices.each(function(d, i) {
var slice = d3.select(this);
return Math.floor(coordinates[0]/avgWidth) * avgWidth + ',' + Math.floor(coordinates[1]/avgHeight) * avgHeight;
};
pieLabels.transition()
.attr('transform', function(d) {
if (labelSunbeamLayout) {
d.outerRadius = arcRadius + 10; // Set Outer Coordinate
d.innerRadius = arcRadius + 15; // Set Inner Coordinate
var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI);
if ((d.startAngle+d.endAngle)/2 < Math.PI) {
rotateAngle -= 90;
} else {
rotateAngle += 90;
}
return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')';
} else {
d.outerRadius = radius + 10; // Set Outer Coordinate
d.innerRadius = radius + 15; // Set Inner Coordinate
/*
Overlapping pie labels are not good. What this attempts to do is, prevent overlapping.
Each label location is hashed, and if a hash collision occurs, we assume an overlap.
Adjust the label's y-position to remove the overlap.
*/
var center = labelsArc.centroid(d);
var hashKey = createHashKey(center);
if (labelLocationHash[hashKey]) {
center[1] -= avgHeight;
}
labelLocationHash[createHashKey(center)] = true;
return 'translate(' + center + ')'
}
});
pieLabels.select(".nv-label text")
slice
.select(".nv-label text")
.style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned
.text(function(d, i) {
var percent = (d.endAngle - d.startAngle) / (2 * Math.PI);
var labelTypes = {
"key" : getX(d.data),
"value": getY(d.data),
"percent": d3.format('%')(percent)
};
return (d.value && percent > labelThreshold) ? labelTypes[labelType] : '';
return (d.value && percent > labelThreshold) ? getX(d.data) : '';
});
var textBox = slice.select('text').node().getBBox();
slice.select(".nv-label rect")
.attr("width", textBox.width + 10)
.attr("height", textBox.height + 10)
.attr("transform", function() {
return "translate(" + [textBox.x - 5, textBox.y - 5] + ")";
});
});
}
@ -249,8 +233,6 @@ nv.models.pie = function() {
}
function arcTween(a) {
a.endAngle = isNaN(a.endAngle) ? 0 : a.endAngle;
a.startAngle = isNaN(a.startAngle) ? 0 : a.startAngle;
if (!donut) a.innerRadius = 0;
var i = d3.interpolate(this._current, a);
this._current = i(0);
@ -278,7 +260,6 @@ nv.models.pie = function() {
//------------------------------------------------------------
chart.dispatch = dispatch;
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if (!arguments.length) return margin;
@ -302,7 +283,8 @@ nv.models.pie = function() {
};
chart.values = function(_) {
nv.log("pie.values() is no longer supported.");
if (!arguments.length) return getValues;
getValues = _;
return chart;
};
@ -317,7 +299,7 @@ nv.models.pie = function() {
getY = d3.functor(_);
return chart;
};
chart.description = function(_) {
if (!arguments.length) return getDescription;
getDescription = _;
@ -329,7 +311,7 @@ nv.models.pie = function() {
showLabels = _;
return chart;
};
chart.labelSunbeamLayout = function(_) {
if (!arguments.length) return labelSunbeamLayout;
labelSunbeamLayout = _;
@ -341,26 +323,19 @@ nv.models.pie = function() {
donutLabelsOutside = _;
return chart;
};
chart.pieLabelsOutside = function(_) {
if (!arguments.length) return pieLabelsOutside;
pieLabelsOutside = _;
return chart;
};
chart.labelType = function(_) {
if (!arguments.length) return labelType;
labelType = _;
labelType = labelType || "key";
return chart;
};
chart.donut = function(_) {
if (!arguments.length) return donut;
donut = _;
return chart;
};
chart.donutRatio = function(_) {
if (!arguments.length) return donutRatio;
donutRatio = _;

@ -1,5 +1,5 @@
nv.models.pieChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -54,11 +54,11 @@ nv.models.pieChart = function() {
availableHeight = (height || parseInt(container.style('height')) || 400)
- margin.top - margin.bottom;
chart.update = function() { container.transition().call(chart); };
chart.update = function() { chart(selection); };
chart.container = this;
//set state.disabled
state.disabled = data.map(function(d) { return !!d.disabled });
state.disabled = data[0].map(function(d) { return !!d.disabled });
if (!defaultState) {
var key;
@ -74,7 +74,7 @@ nv.models.pieChart = function() {
//------------------------------------------------------------
// Display No Data message if there's nothing to show.
if (!data || !data.length) {
if (!data[0] || !data[0].length) {
var noDataText = container.selectAll('.nv-noData').data([noData]);
noDataText.enter().append('text')
@ -117,7 +117,7 @@ nv.models.pieChart = function() {
.key(pie.x());
wrap.select('.nv-legendWrap')
.datum(data)
.datum(pie.values()(data[0]))
.call(legend);
if ( margin.top != legend.height()) {
@ -145,7 +145,7 @@ nv.models.pieChart = function() {
var pieWrap = g.select('.nv-pieWrap')
.datum([data]);
.datum(data);
d3.transition(pieWrap).call(pie);
@ -156,10 +156,21 @@ nv.models.pieChart = function() {
// Event Handling/Dispatching (in chart's scope)
//------------------------------------------------------------
legend.dispatch.on('stateChange', function(newState) {
state = newState;
legend.dispatch.on('legendClick', function(d,i, that) {
d.disabled = !d.disabled;
if (!pie.values()(data[0]).filter(function(d) { return !d.disabled }).length) {
pie.values()(data[0]).map(function(d) {
d.disabled = false;
wrap.selectAll('.nv-series').classed('disabled', false);
return d;
});
}
state.disabled = data[0].map(function(d) { return !!d.disabled });
dispatch.stateChange(state);
chart.update();
selection.transition().call(chart)
});
pie.dispatch.on('elementMouseout.tooltip', function(e) {
@ -170,14 +181,14 @@ nv.models.pieChart = function() {
dispatch.on('changeState', function(e) {
if (typeof e.disabled !== 'undefined') {
data.forEach(function(series,i) {
data[0].forEach(function(series,i) {
series.disabled = e.disabled[i];
});
state.disabled = e.disabled;
}
chart.update();
selection.call(chart);
});
//============================================================
@ -217,9 +228,8 @@ nv.models.pieChart = function() {
chart.dispatch = dispatch;
chart.pie = pie;
d3.rebind(chart, pie, 'valueFormat', 'values', 'x', 'y', 'description', 'id', 'showLabels', 'donutLabelsOutside', 'pieLabelsOutside', 'labelType', 'donut', 'donutRatio', 'labelThreshold');
chart.options = nv.utils.optionsFunc.bind(chart);
d3.rebind(chart, pie, 'valueFormat', 'values', 'x', 'y', 'description', 'id', 'showLabels', 'donutLabelsOutside', 'pieLabelsOutside', 'donut', 'donutRatio', 'labelThreshold');
chart.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;

@ -1,6 +1,6 @@
nv.models.scatter = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -22,7 +22,6 @@ nv.models.scatter = function() {
, forceY = [] // List of numbers to Force into the Y scale
, forceSize = [] // List of numbers to Force into the Size scale
, interactive = true // If true, plots a voronoi overlay for advanced point intersection
, pointKey = null
, pointActive = function(d) { return !d.notActive } // any points that return false will be filtered out
, padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart
, padDataOuter = .1 //outerPadding to imitate ordinal scale outer padding
@ -31,8 +30,6 @@ nv.models.scatter = function() {
, clipRadius = function() { return 25 } // function to get the radius for voronoi point clips
, xDomain = null // Override x domain (skips the calculation from data)
, yDomain = null // Override y domain
, xRange = null // Override x range
, yRange = null // Override y range
, sizeDomain = null // Override point size domain
, sizeRange = null
, singlePoint = false
@ -62,10 +59,12 @@ nv.models.scatter = function() {
container = d3.select(this);
//add series index to each data point for reference
data.forEach(function(series, i) {
series.values.forEach(function(point) {
data = data.map(function(series, i) {
series.values = series.values.map(function(point) {
point.series = i;
return point;
});
return series;
});
//------------------------------------------------------------
@ -84,13 +83,13 @@ nv.models.scatter = function() {
x .domain(xDomain || d3.extent(seriesData.map(function(d) { return d.x; }).concat(forceX)))
if (padData && data[0])
x.range(xRange || [(availableWidth * padDataOuter + availableWidth) / (2 *data[0].values.length), availableWidth - availableWidth * (1 + padDataOuter) / (2 * data[0].values.length) ]);
x.range([(availableWidth * padDataOuter + availableWidth) / (2 *data[0].values.length), availableWidth - availableWidth * (1 + padDataOuter) / (2 * data[0].values.length) ]);
//x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]);
else
x.range(xRange || [0, availableWidth]);
x.range([0, availableWidth]);
y .domain(yDomain || d3.extent(seriesData.map(function(d) { return d.y }).concat(forceY)))
.range(yRange || [availableHeight, 0]);
.range([availableHeight, 0]);
z .domain(sizeDomain || d3.extent(seriesData.map(function(d) { return d.size }).concat(forceSize)))
.range(sizeRange || [16, 256]);
@ -104,7 +103,7 @@ nv.models.scatter = function() {
if (y.domain()[0] === y.domain()[1])
y.domain()[0] ?
y.domain([y.domain()[0] - y.domain()[0] * 0.01, y.domain()[1] + y.domain()[1] * 0.01])
y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01])
: y.domain([-1,1]);
if ( isNaN(x.domain()[0])) {
@ -146,7 +145,7 @@ nv.models.scatter = function() {
wrap.select('#nv-edge-clip-' + id + ' rect')
.attr('width', availableWidth)
.attr('height', (availableHeight > 0) ? availableHeight : 0);
.attr('height', availableHeight);
g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
@ -161,16 +160,8 @@ nv.models.scatter = function() {
return group.values
.map(function(point, pointIndex) {
// *Adding noise to make duplicates very unlikely
// *Injecting series and point index for reference
/* *Adding a 'jitter' to the points, because there's an issue in d3.geom.voronoi.
*/
var pX = getX(point,pointIndex);
var pY = getY(point,pointIndex);
return [x(pX)+ Math.random() * 1e-7,
y(pY)+ Math.random() * 1e-7,
groupIndex,
pointIndex, point]; //temp hack to add noise untill I think of a better way so there are no duplicates
// **Injecting series and point index for reference
return [x(getX(point,pointIndex)) * (Math.random() / 1e12 + 1) , y(getY(point,pointIndex)) * (Math.random() / 1e12 + 1), groupIndex, pointIndex, point]; //temp hack to add noise untill I think of a better way so there are no duplicates
})
.filter(function(pointArray, pointIndex) {
return pointActive(pointArray[4], pointIndex); // Issue #237.. move filter to after map, so pointIndex is correct!
@ -206,13 +197,13 @@ nv.models.scatter = function() {
}
if(vertices.length) {
// if(vertices.length < 3) {
// Issue #283 - Adding 2 dummy points to the voronoi b/c voronoi requires min 3 points to work
vertices.push([x.range()[0] - 20, y.range()[0] - 20, null, null]);
vertices.push([x.range()[1] + 20, y.range()[1] + 20, null, null]);
vertices.push([x.range()[0] - 20, y.range()[0] + 20, null, null]);
vertices.push([x.range()[1] + 20, y.range()[1] - 20, null, null]);
}
// }
var bounds = d3.geom.polygon([
[-10,-10],
@ -230,6 +221,7 @@ nv.models.scatter = function() {
});
var pointPaths = wrap.select('.nv-point-paths').selectAll('path')
.data(voronoi);
pointPaths.enter().append('path')
@ -237,37 +229,50 @@ nv.models.scatter = function() {
pointPaths.exit().remove();
pointPaths
.attr('d', function(d) {
if (d.data.length === 0)
if (d.data.length === 0)
return 'M 0 0'
else
return 'M' + d.data.join('L') + 'Z';
else
return 'M' + d.data.join('L') + 'Z';
});
var mouseEventCallback = function(d,mDispatch) {
pointPaths
.on('click', function(d) {
if (needsUpdate) return 0;
var series = data[d.series];
if (typeof series === 'undefined') return;
var point = series.values[d.point];
var series = data[d.series],
point = series.values[d.point];
mDispatch({
dispatch.elementClick({
point: point,
series: series,
pos: [x(getX(point, d.point)) + margin.left, y(getY(point, d.point)) + margin.top],
seriesIndex: d.series,
pointIndex: d.point
});
};
pointPaths
.on('click', function(d) {
mouseEventCallback(d, dispatch.elementClick);
})
.on('mouseover', function(d) {
mouseEventCallback(d, dispatch.elementMouseover);
if (needsUpdate) return 0;
var series = data[d.series],
point = series.values[d.point];
dispatch.elementMouseover({
point: point,
series: series,
pos: [x(getX(point, d.point)) + margin.left, y(getY(point, d.point)) + margin.top],
seriesIndex: d.series,
pointIndex: d.point
});
})
.on('mouseout', function(d, i) {
mouseEventCallback(d, dispatch.elementMouseout);
if (needsUpdate) return 0;
var series = data[d.series],
point = series.values[d.point];
dispatch.elementMouseout({
point: point,
series: series,
seriesIndex: d.series,
pointIndex: d.point
});
});
@ -288,7 +293,7 @@ nv.models.scatter = function() {
.selectAll('.nv-point')
//.data(dataWithPoints)
//.style('pointer-events', 'auto') // recativate events, disabled by css
.on('click', function(d,i) {
.on('click', function(d,i) {
//nv.log('test', d, i);
if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point
var series = data[d.series],
@ -339,13 +344,14 @@ nv.models.scatter = function() {
groups.enter().append('g')
.style('stroke-opacity', 1e-6)
.style('fill-opacity', 1e-6);
groups.exit()
d3.transition(groups.exit())
.style('stroke-opacity', 1e-6)
.style('fill-opacity', 1e-6)
.remove();
groups
.attr('class', function(d,i) { return 'nv-group nv-series-' + i })
.classed('hover', function(d) { return d.hover });
groups
.transition()
d3.transition(groups)
.style('fill', function(d,i) { return color(d, i) })
.style('stroke', function(d,i) { return color(d, i) })
.style('stroke-opacity', 1)
@ -355,28 +361,20 @@ nv.models.scatter = function() {
if (onlyCircles) {
var points = groups.selectAll('circle.nv-point')
.data(function(d) { return d.values }, pointKey);
.data(function(d) { return d.values });
points.enter().append('circle')
.style('fill', function (d,i) { return d.color })
.style('stroke', function (d,i) { return d.color })
.attr('cx', function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) })
.attr('cy', function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) })
.attr('cx', function(d,i) { return x0(getX(d,i)) })
.attr('cy', function(d,i) { return y0(getY(d,i)) })
.attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) });
points.exit().remove();
groups.exit().selectAll('path.nv-point').transition()
.attr('cx', function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
.attr('cy', function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
d3.transition(groups.exit().selectAll('path.nv-point'))
.attr('cx', function(d,i) { return x(getX(d,i)) })
.attr('cy', function(d,i) { return y(getY(d,i)) })
.remove();
points.each(function(d,i) {
d3.select(this)
.classed('nv-point', true)
.classed('nv-point-' + i, true)
.classed('hover',false)
;
});
points.transition()
.attr('cx', function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
.attr('cy', function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
points.attr('class', function(d,i) { return 'nv-point nv-point-' + i });
d3.transition(points)
.attr('cx', function(d,i) { return x(getX(d,i)) })
.attr('cy', function(d,i) { return y(getY(d,i)) })
.attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) });
} else {
@ -384,8 +382,6 @@ nv.models.scatter = function() {
var points = groups.selectAll('path.nv-point')
.data(function(d) { return d.values });
points.enter().append('path')
.style('fill', function (d,i) { return d.color })
.style('stroke', function (d,i) { return d.color })
.attr('transform', function(d,i) {
return 'translate(' + x0(getX(d,i)) + ',' + y0(getY(d,i)) + ')'
})
@ -395,20 +391,13 @@ nv.models.scatter = function() {
.size(function(d,i) { return z(getSize(d,i)) })
);
points.exit().remove();
groups.exit().selectAll('path.nv-point')
.transition()
d3.transition(groups.exit().selectAll('path.nv-point'))
.attr('transform', function(d,i) {
return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')'
})
.remove();
points.each(function(d,i) {
d3.select(this)
.classed('nv-point', true)
.classed('nv-point-' + i, true)
.classed('hover',false)
;
});
points.transition()
points.attr('class', function(d,i) { return 'nv-point nv-point-' + i });
d3.transition(points)
.attr('transform', function(d,i) {
//nv.log(d,i,getX(d,i), x(getX(d,i)));
return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')'
@ -440,23 +429,17 @@ nv.models.scatter = function() {
//============================================================
// Event Handling/Dispatching (out of chart's scope)
//------------------------------------------------------------
chart.clearHighlights = function() {
//Remove the 'hover' class from all highlighted points.
d3.selectAll(".nv-chart-" + id + " .nv-point.hover").classed("hover",false);
};
chart.highlightPoint = function(seriesIndex,pointIndex,isHoverOver) {
d3.select(".nv-chart-" + id + " .nv-series-" + seriesIndex + " .nv-point-" + pointIndex)
.classed("hover",isHoverOver);
};
dispatch.on('elementMouseover.point', function(d) {
if (interactive) chart.highlightPoint(d.seriesIndex,d.pointIndex,true);
if (interactive)
d3.select('.nv-chart-' + id + ' .nv-series-' + d.seriesIndex + ' .nv-point-' + d.pointIndex)
.classed('hover', true);
});
dispatch.on('elementMouseout.point', function(d) {
if (interactive) chart.highlightPoint(d.seriesIndex,d.pointIndex,false);
if (interactive)
d3.select('.nv-chart-' + id + ' .nv-series-' + d.seriesIndex + ' .nv-point-' + d.pointIndex)
.classed('hover', false);
});
//============================================================
@ -467,7 +450,6 @@ nv.models.scatter = function() {
//------------------------------------------------------------
chart.dispatch = dispatch;
chart.options = nv.utils.optionsFunc.bind(chart);
chart.x = function(_) {
if (!arguments.length) return getX;
@ -544,18 +526,6 @@ nv.models.scatter = function() {
return chart;
};
chart.xRange = function(_) {
if (!arguments.length) return xRange;
xRange = _;
return chart;
};
chart.yRange = function(_) {
if (!arguments.length) return yRange;
yRange = _;
return chart;
};
chart.sizeRange = function(_) {
if (!arguments.length) return sizeRange;
sizeRange = _;
@ -586,12 +556,6 @@ nv.models.scatter = function() {
return chart;
};
chart.pointKey = function(_) {
if (!arguments.length) return pointKey;
pointKey = _;
return chart;
};
chart.pointActive = function(_) {
if (!arguments.length) return pointActive;
pointActive = _;

@ -1,5 +1,6 @@
nv.models.scatterChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -24,21 +25,18 @@ nv.models.scatterChart = function() {
, showDistX = false
, showDistY = false
, showLegend = true
, showXAxis = true
, showYAxis = true
, rightAlignYAxis = false
, showControls = !!d3.fisheye
, fisheye = 0
, pauseFisheye = false
, tooltips = true
, tooltipX = function(key, x, y) { return '<strong>' + x + '</strong>' }
, 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."
, transitionDuration = 250
;
scatter
@ -50,7 +48,7 @@ nv.models.scatterChart = function() {
.tickPadding(10)
;
yAxis
.orient((rightAlignYAxis) ? 'right' : 'left')
.orient('left')
.tickPadding(10)
;
distX
@ -60,8 +58,6 @@ nv.models.scatterChart = function() {
.axis('y')
;
controls.updateState(false);
//============================================================
@ -108,7 +104,7 @@ nv.models.scatterChart = function() {
availableHeight = (height || parseInt(container.style('height')) || 400)
- margin.top - margin.bottom;
chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
chart.update = function() { chart(selection) };
chart.container = this;
//set state.disabled
@ -183,8 +179,7 @@ nv.models.scatterChart = function() {
// Legend
if (showLegend) {
var legendWidth = (showControls) ? availableWidth / 2 : availableWidth;
legend.width(legendWidth);
legend.width( availableWidth / 2 );
wrap.select('.nv-legendWrap')
.datum(data)
@ -197,7 +192,7 @@ nv.models.scatterChart = function() {
}
wrap.select('.nv-legendWrap')
.attr('transform', 'translate(' + (availableWidth - legendWidth) + ',' + (-margin.top) +')');
.attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')');
}
//------------------------------------------------------------
@ -219,10 +214,6 @@ nv.models.scatterChart = function() {
wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
if (rightAlignYAxis) {
g.select(".nv-y.nv-axis")
.attr("transform", "translate(" + availableWidth + ",0)");
}
//------------------------------------------------------------
// Main Chart Component(s)
@ -232,34 +223,22 @@ nv.models.scatterChart = function() {
.height(availableHeight)
.color(data.map(function(d,i) {
return d.color || color(d, i);
}).filter(function(d,i) { return !data[i].disabled }));
if (xPadding !== 0)
scatter.xDomain(null);
if (yPadding !== 0)
scatter.yDomain(null);
}).filter(function(d,i) { return !data[i].disabled }))
wrap.select('.nv-scatterWrap')
.datum(data.filter(function(d) { return !d.disabled }))
.call(scatter);
//Adjust for x and y padding
if (xPadding !== 0) {
if (xPadding) {
var xRange = x.domain()[1] - x.domain()[0];
scatter.xDomain([x.domain()[0] - (xPadding * xRange), x.domain()[1] + (xPadding * xRange)]);
x.domain([x.domain()[0] - (xPadding * xRange), x.domain()[1] + (xPadding * xRange)]);
}
if (yPadding !== 0) {
if (yPadding) {
var yRange = y.domain()[1] - y.domain()[0];
scatter.yDomain([y.domain()[0] - (yPadding * yRange), y.domain()[1] + (yPadding * yRange)]);
}
//Only need to update the scatter again if x/yPadding changed the domain.
if (yPadding !== 0 || xPadding !== 0) {
wrap.select('.nv-scatterWrap')
.datum(data.filter(function(d) { return !d.disabled }))
.call(scatter);
y.domain([y.domain()[0] - (yPadding * yRange), y.domain()[1] + (yPadding * yRange)]);
}
//------------------------------------------------------------
@ -267,27 +246,24 @@ nv.models.scatterChart = function() {
//------------------------------------------------------------
// Setup Axes
if (showXAxis) {
xAxis
.scale(x)
.ticks( xAxis.ticks() && xAxis.ticks().length ? xAxis.ticks() : availableWidth / 100 )
.tickSize( -availableHeight , 0);
g.select('.nv-x.nv-axis')
.attr('transform', 'translate(0,' + y.range()[0] + ')')
.call(xAxis);
xAxis
.scale(x)
.ticks( xAxis.ticks() && xAxis.ticks().length ? xAxis.ticks() : availableWidth / 100 )
.tickSize( -availableHeight , 0);
}
g.select('.nv-x.nv-axis')
.attr('transform', 'translate(0,' + y.range()[0] + ')')
.call(xAxis);
if (showYAxis) {
yAxis
.scale(y)
.ticks( yAxis.ticks() && yAxis.ticks().length ? yAxis.ticks() : availableHeight / 36 )
.tickSize( -availableWidth, 0);
g.select('.nv-y.nv-axis')
.call(yAxis);
}
yAxis
.scale(y)
.ticks( yAxis.ticks() && yAxis.ticks().length ? yAxis.ticks() : availableHeight / 36 )
.tickSize( -availableWidth, 0);
g.select('.nv-y.nv-axis')
.call(yAxis);
if (showDistX) {
@ -317,8 +293,7 @@ nv.models.scatterChart = function() {
gEnter.select('.nv-distWrap').append('g')
.attr('class', 'nv-distributionY');
g.select('.nv-distributionY')
.attr('transform',
'translate(' + (rightAlignYAxis ? availableWidth : -distY.size() ) + ',0)')
.attr('transform', 'translate(-' + distY.size() + ',0)')
.datum(data.filter(function(d) { return !d.disabled }))
.call(distY);
}
@ -356,12 +331,8 @@ nv.models.scatterChart = function() {
g.select('.nv-scatterWrap')
.call(scatter);
if (showXAxis)
g.select('.nv-x.nv-axis').call(xAxis);
if (showYAxis)
g.select('.nv-y.nv-axis').call(yAxis);
g.select('.nv-x.nv-axis').call(xAxis);
g.select('.nv-y.nv-axis').call(yAxis);
g.select('.nv-distributionX')
.datum(data.filter(function(d) { return !d.disabled }))
.call(distX);
@ -394,18 +365,41 @@ nv.models.scatterChart = function() {
pauseFisheye = false;
}
chart.update();
chart(selection);
});
legend.dispatch.on('stateChange', function(newState) {
state.disabled = newState.disabled;
legend.dispatch.on('legendClick', function(d,i, that) {
d.disabled = !d.disabled;
if (!data.filter(function(d) { return !d.disabled }).length) {
data.map(function(d) {
d.disabled = false;
wrap.selectAll('.nv-series').classed('disabled', false);
return d;
});
}
state.disabled = data.map(function(d) { return !!d.disabled });
dispatch.stateChange(state);
chart.update();
chart(selection);
});
/*
legend.dispatch.on('legendMouseover', function(d, i) {
d.hover = true;
chart(selection);
});
legend.dispatch.on('legendMouseout', function(d, i) {
d.hover = false;
chart(selection);
});
*/
scatter.dispatch.on('elementMouseover.tooltip', function(e) {
d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
.attr('y1', function(d,i) { return e.pos[1] - availableHeight;});
.attr('y1', e.pos[1] - availableHeight);
d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex)
.attr('x2', e.pos[0] + distX.size());
@ -428,7 +422,7 @@ nv.models.scatterChart = function() {
state.disabled = e.disabled;
}
chart.update();
selection.call(chart);
});
//============================================================
@ -478,9 +472,8 @@ nv.models.scatterChart = function() {
chart.distX = distX;
chart.distY = distY;
d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi');
chart.options = nv.utils.optionsFunc.bind(chart);
d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi');
chart.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
@ -535,26 +528,6 @@ nv.models.scatterChart = function() {
return chart;
};
chart.showXAxis = function(_) {
if (!arguments.length) return showXAxis;
showXAxis = _;
return chart;
};
chart.showYAxis = function(_) {
if (!arguments.length) return showYAxis;
showYAxis = _;
return chart;
};
chart.rightAlignYAxis = function(_) {
if(!arguments.length) return rightAlignYAxis;
rightAlignYAxis = _;
yAxis.orient( (_) ? 'right' : 'left');
return chart;
};
chart.fisheye = function(_) {
if (!arguments.length) return fisheye;
fisheye = _;
@ -615,12 +588,6 @@ nv.models.scatterChart = function() {
return chart;
};
chart.transitionDuration = function(_) {
if (!arguments.length) return transitionDuration;
transitionDuration = _;
return chart;
};
//============================================================

@ -1,6 +1,6 @@
nv.models.scatterPlusLineChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -23,9 +23,6 @@ nv.models.scatterPlusLineChart = function() {
, showDistX = false
, showDistY = false
, showLegend = true
, showXAxis = true
, showYAxis = true
, rightAlignYAxis = false
, showControls = !!d3.fisheye
, fisheye = 0
, pauseFisheye = false
@ -34,11 +31,11 @@ nv.models.scatterPlusLineChart = function() {
, tooltipY = function(key, x, y) { return '<strong>' + y + '</strong>' }
, tooltip = function(key, x, y, date) { return '<h3>' + key + '</h3>'
+ '<p>' + date + '</p>' }
//, tooltip = null
, state = {}
, defaultState = null
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
, noData = "No Data Available."
, transitionDuration = 250
;
scatter
@ -50,7 +47,7 @@ nv.models.scatterPlusLineChart = function() {
.tickPadding(10)
;
yAxis
.orient((rightAlignYAxis) ? 'right' : 'left')
.orient('left')
.tickPadding(10)
;
distX
@ -59,8 +56,7 @@ nv.models.scatterPlusLineChart = function() {
distY
.axis('y')
;
controls.updateState(false);
//============================================================
@ -107,7 +103,7 @@ nv.models.scatterPlusLineChart = function() {
availableHeight = (height || parseInt(container.style('height')) || 400)
- margin.top - margin.bottom;
chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
chart.update = function() { chart(selection) };
chart.container = this;
//set state.disabled
@ -169,7 +165,7 @@ nv.models.scatterPlusLineChart = function() {
var g = wrap.select('g')
// background for pointer events
gEnter.append('rect').attr('class', 'nvd3 nv-background').style("pointer-events","none");
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');
@ -181,11 +177,6 @@ nv.models.scatterPlusLineChart = function() {
wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
if (rightAlignYAxis) {
g.select(".nv-y.nv-axis")
.attr("transform", "translate(" + availableWidth + ",0)");
}
//------------------------------------------------------------
@ -240,56 +231,53 @@ nv.models.scatterPlusLineChart = function() {
.datum(data.filter(function(d) { return !d.disabled }))
.call(scatter);
wrap.select('.nv-regressionLinesWrap')
.attr('clip-path', 'url(#nv-edge-clip-' + scatter.id() + ')');
var regWrap = wrap.select('.nv-regressionLinesWrap').selectAll('.nv-regLines')
.data(function(d) {return d });
regWrap.enter().append('g').attr('class', 'nv-regLines');
.data(function(d) { return d });
var regLine = regWrap.selectAll('.nv-regLine').data(function(d){return [d]});
var regLineEnter = regLine.enter()
var reglines = regWrap.enter()
.append('g').attr('class', 'nv-regLines')
.append('line').attr('class', 'nv-regLine')
.style('stroke-opacity', 0);
regLine
.transition()
//d3.transition(regWrap.selectAll('.nv-regLines line'))
regWrap.selectAll('.nv-regLines line')
.attr('x1', x.range()[0])
.attr('x2', x.range()[1])
.attr('y1', function(d,i) {return y(x.domain()[0] * d.slope + d.intercept) })
.attr('y1', function(d,i) { return y(x.domain()[0] * d.slope + d.intercept) })
.attr('y2', function(d,i) { return y(x.domain()[1] * d.slope + d.intercept) })
.style('stroke', function(d,i,j) { return color(d,j) })
.style('stroke-opacity', function(d,i) {
return (d.disabled || typeof d.slope === 'undefined' || typeof d.intercept === 'undefined') ? 0 : 1
});
//------------------------------------------------------------
//------------------------------------------------------------
// Setup Axes
if (showXAxis) {
xAxis
.scale(x)
.ticks( xAxis.ticks() ? xAxis.ticks() : availableWidth / 100 )
.tickSize( -availableHeight , 0);
xAxis
.scale(x)
.ticks( xAxis.ticks() ? xAxis.ticks() : availableWidth / 100 )
.tickSize( -availableHeight , 0);
g.select('.nv-x.nv-axis')
.attr('transform', 'translate(0,' + y.range()[0] + ')')
.call(xAxis);
}
g.select('.nv-x.nv-axis')
.attr('transform', 'translate(0,' + y.range()[0] + ')')
.call(xAxis);
if (showYAxis) {
yAxis
.scale(y)
.ticks( yAxis.ticks() ? yAxis.ticks() : availableHeight / 36 )
.tickSize( -availableWidth, 0);
g.select('.nv-y.nv-axis')
.call(yAxis);
}
yAxis
.scale(y)
.ticks( yAxis.ticks() ? yAxis.ticks() : availableHeight / 36 )
.tickSize( -availableWidth, 0);
g.select('.nv-y.nv-axis')
.call(yAxis);
if (showDistX) {
@ -319,7 +307,7 @@ nv.models.scatterPlusLineChart = function() {
gEnter.select('.nv-distWrap').append('g')
.attr('class', 'nv-distributionY');
g.select('.nv-distributionY')
.attr('transform', 'translate(' + (rightAlignYAxis ? availableWidth : -distY.size() ) + ',0)')
.attr('transform', 'translate(-' + distY.size() + ',0)')
.datum(data.filter(function(d) { return !d.disabled }))
.call(distY);
}
@ -332,8 +320,7 @@ nv.models.scatterPlusLineChart = function() {
if (d3.fisheye) {
g.select('.nv-background')
.attr('width', availableWidth)
.attr('height', availableHeight)
;
.attr('height', availableHeight);
g.select('.nv-background').on('mousemove', updateFisheye);
g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;});
@ -358,13 +345,8 @@ nv.models.scatterPlusLineChart = function() {
g.select('.nv-scatterWrap')
.datum(data.filter(function(d) { return !d.disabled }))
.call(scatter);
if (showXAxis)
g.select('.nv-x.nv-axis').call(xAxis);
if (showYAxis)
g.select('.nv-y.nv-axis').call(yAxis);
g.select('.nv-x.nv-axis').call(xAxis);
g.select('.nv-y.nv-axis').call(yAxis);
g.select('.nv-distributionX')
.datum(data.filter(function(d) { return !d.disabled }))
.call(distX);
@ -397,15 +379,37 @@ nv.models.scatterPlusLineChart = function() {
pauseFisheye = false;
}
chart.update();
chart(selection);
});
legend.dispatch.on('stateChange', function(newState) {
state = newState;
legend.dispatch.on('legendClick', function(d,i, that) {
d.disabled = !d.disabled;
if (!data.filter(function(d) { return !d.disabled }).length) {
data.map(function(d) {
d.disabled = false;
wrap.selectAll('.nv-series').classed('disabled', false);
return d;
});
}
state.disabled = data.map(function(d) { return !!d.disabled });
dispatch.stateChange(state);
chart.update();
chart(selection);
});
/*
legend.dispatch.on('legendMouseover', function(d, i) {
d.hover = true;
chart(selection);
});
legend.dispatch.on('legendMouseout', function(d, i) {
d.hover = false;
chart(selection);
});
*/
scatter.dispatch.on('elementMouseover.tooltip', function(e) {
d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex)
@ -432,7 +436,7 @@ nv.models.scatterPlusLineChart = function() {
state.disabled = e.disabled;
}
chart.update();
selection.call(chart);
});
//============================================================
@ -482,10 +486,8 @@ nv.models.scatterPlusLineChart = function() {
chart.distX = distX;
chart.distY = distY;
d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi');
d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi');
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
@ -540,25 +542,6 @@ nv.models.scatterPlusLineChart = function() {
return chart;
};
chart.showXAxis = function(_) {
if (!arguments.length) return showXAxis;
showXAxis = _;
return chart;
};
chart.showYAxis = function(_) {
if (!arguments.length) return showYAxis;
showYAxis = _;
return chart;
};
chart.rightAlignYAxis = function(_) {
if(!arguments.length) return rightAlignYAxis;
rightAlignYAxis = _;
yAxis.orient( (_) ? 'right' : 'left');
return chart;
};
chart.fisheye = function(_) {
if (!arguments.length) return fisheye;
fisheye = _;
@ -607,12 +590,6 @@ nv.models.scatterPlusLineChart = function() {
return chart;
};
chart.transitionDuration = function(_) {
if (!arguments.length) return transitionDuration;
transitionDuration = _;
return chart;
};
//============================================================

@ -1,6 +1,6 @@
nv.models.sparkline = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -16,8 +16,6 @@ nv.models.sparkline = function() {
, color = nv.utils.getColor(['#000'])
, xDomain
, yDomain
, xRange
, yRange
;
//============================================================
@ -34,10 +32,10 @@ nv.models.sparkline = function() {
// Setup Scales
x .domain(xDomain || d3.extent(data, getX ))
.range(xRange || [0, availableWidth]);
.range([0, availableWidth]);
y .domain(yDomain || d3.extent(data, getY ))
.range(yRange || [availableHeight, 0]);
.range([availableHeight, 0]);
//------------------------------------------------------------
@ -104,8 +102,7 @@ nv.models.sparkline = function() {
//============================================================
// Expose Public Variables
//------------------------------------------------------------
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
@ -163,18 +160,6 @@ nv.models.sparkline = function() {
return chart;
};
chart.xRange = function(_) {
if (!arguments.length) return xRange;
xRange = _;
return chart;
};
chart.yRange = function(_) {
if (!arguments.length) return yRange;
yRange = _;
return chart;
};
chart.animate = function(_) {
if (!arguments.length) return animate;
animate = _;

@ -1,6 +1,6 @@
nv.models.sparklinePlus = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -229,8 +229,6 @@ nv.models.sparklinePlus = function() {
d3.rebind(chart, sparkline, 'x', 'y', 'xScale', 'yScale', 'color');
chart.options = nv.utils.optionsFunc.bind(chart);
chart.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;

@ -1,6 +1,6 @@
nv.models.stackedArea = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -57,35 +57,32 @@ nv.models.stackedArea = function() {
//------------------------------------------------------------
var dataRaw = data;
// Injecting point index into each point because d3.layout.stack().out does not give index
data.forEach(function(aseries, i) {
aseries.seriesIndex = i;
aseries.values = aseries.values.map(function(d, j) {
d.index = j;
d.seriesIndex = i;
return d;
});
});
// ***Also storing getY(d,i) as stackedY so that it can be set to 0 if series is disabled
data = data.map(function(aseries, i) {
aseries.values = aseries.values.map(function(d, j) {
d.index = j;
d.stackedY = aseries.disabled ? 0 : getY(d,j);
return d;
})
return aseries;
});
var dataFiltered = data.filter(function(series) {
return !series.disabled;
});
data = d3.layout.stack()
.order(order)
.offset(offset)
.values(function(d) { return d.values }) //TODO: make values customizeable in EVERY model in this fashion
.x(getX)
.y(getY)
.y(function(d) { return d.stackedY })
.out(function(d, y0, y) {
var yHeight = (getY(d) === 0) ? 0 : y;
d.display = {
y: yHeight,
y0: y0
};
d.display = {
y: y,
y0: y0
};
})
(dataFiltered);
(data);
//------------------------------------------------------------
@ -112,15 +109,20 @@ nv.models.stackedArea = function() {
.y(function(d) { return d.display.y + d.display.y0 })
.forceY([0])
.color(data.map(function(d,i) {
return d.color || color(d, d.seriesIndex);
}));
return d.color || color(d, i);
}).filter(function(d,i) { return !data[i].disabled }));
var scatterWrap = g.select('.nv-scatterWrap')
.datum(data);
.datum(data.filter(function(d) { return !d.disabled }))
//d3.transition(scatterWrap).call(scatter);
scatterWrap.call(scatter);
defsEnter.append('clipPath')
.attr('id', 'nv-edge-clip-' + id)
.append('rect');
@ -131,14 +133,13 @@ nv.models.stackedArea = function() {
g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
var area = d3.svg.area()
.x(function(d,i) { return x(getX(d,i)) })
.y0(function(d) {
return y(d.display.y0)
})
.y1(function(d) {
return y(d.display.y + d.display.y0)
})
.y0(function(d) { return y(d.display.y0) })
.y1(function(d) { return y(d.display.y + d.display.y0) })
.interpolate(interpolate);
var zeroArea = d3.svg.area()
@ -149,18 +150,15 @@ nv.models.stackedArea = function() {
var path = g.select('.nv-areaWrap').selectAll('path.nv-area')
.data(function(d) { return d });
//.data(function(d) { return d }, function(d) { return d.key });
path.enter().append('path').attr('class', function(d,i) { return 'nv-area nv-area-' + i })
.attr('d', function(d,i){
return zeroArea(d.values, d.seriesIndex);
})
.on('mouseover', function(d,i) {
d3.select(this).classed('hover', true);
dispatch.areaMouseover({
point: d,
series: d.key,
pos: [d3.event.pageX, d3.event.pageY],
seriesIndex: d.seriesIndex
seriesIndex: i
});
})
.on('mouseout', function(d,i) {
@ -169,7 +167,7 @@ nv.models.stackedArea = function() {
point: d,
series: d.key,
pos: [d3.event.pageX, d3.event.pageY],
seriesIndex: d.seriesIndex
seriesIndex: i
});
})
.on('click', function(d,i) {
@ -178,22 +176,19 @@ nv.models.stackedArea = function() {
point: d,
series: d.key,
pos: [d3.event.pageX, d3.event.pageY],
seriesIndex: d.seriesIndex
seriesIndex: i
});
})
path.exit().remove();
//d3.transition(path.exit())
path.exit()
.attr('d', function(d,i) { return zeroArea(d.values,i) })
.remove();
path
.style('fill', function(d,i){
return d.color || color(d, d.seriesIndex)
})
.style('stroke', function(d,i){ return d.color || color(d, d.seriesIndex) });
path.transition()
.attr('d', function(d,i) {
return area(d.values,i)
});
.style('fill', function(d,i){ return d.color || color(d, i) })
.style('stroke', function(d,i){ return d.color || color(d, i) });
//d3.transition(path)
path
.attr('d', function(d,i) { return area(d.values,i) })
//============================================================
@ -208,29 +203,6 @@ nv.models.stackedArea = function() {
});
//============================================================
//Special offset functions
chart.d3_stackedOffset_stackPercent = function(stackData) {
var n = stackData.length, //How many series
m = stackData[0].length, //how many points per series
k = 1 / n,
i,
j,
o,
y0 = [];
for (j = 0; j < m; ++j) { //Looping through all points
for (i = 0, o = 0; i < dataRaw.length; i++) //looping through series'
o += getY(dataRaw[i].values[j]) //total value of all points at a certian point in time.
if (o) for (i = 0; i < n; i++)
stackData[i][j][1] /= o;
else
for (i = 0; i < n; i++)
stackData[i][j][1] = k;
}
for (j = 0; j < m; ++j) y0[j] = 0;
return y0;
};
});
@ -256,6 +228,7 @@ nv.models.stackedArea = function() {
//============================================================
//============================================================
// Global getters and setters
//------------------------------------------------------------
@ -263,10 +236,7 @@ nv.models.stackedArea = function() {
chart.dispatch = dispatch;
chart.scatter = scatter;
d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange',
'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'useVoronoi','clipRadius','highlightPoint','clearHighlights');
chart.options = nv.utils.optionsFunc.bind(chart);
d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius');
chart.x = function(_) {
if (!arguments.length) return getX;
@ -347,10 +317,6 @@ nv.models.stackedArea = function() {
chart.offset('expand');
chart.order('default');
break;
case 'stack_percent':
chart.offset(chart.d3_stackedOffset_stackPercent);
chart.order('default');
break;
}
return chart;
@ -359,8 +325,10 @@ nv.models.stackedArea = function() {
chart.interpolate = function(_) {
if (!arguments.length) return interpolate;
interpolate = _;
return chart;
return interpolate;
};
//============================================================

@ -1,6 +1,6 @@
nv.models.stackedAreaChart = function() {
"use strict";
//============================================================
// Public Variables with Default Settings
//------------------------------------------------------------
@ -10,7 +10,6 @@ nv.models.stackedAreaChart = function() {
, yAxis = nv.models.axis()
, legend = nv.models.legend()
, controls = nv.models.legend()
, interactiveLayer = nv.interactiveGuideline()
;
var margin = {top: 30, right: 25, bottom: 50, left: 60}
@ -19,10 +18,6 @@ nv.models.stackedAreaChart = function() {
, color = nv.utils.defaultColor() // a function that takes in d, i and returns color
, showControls = true
, showLegend = true
, showXAxis = true
, showYAxis = true
, rightAlignYAxis = false
, useInteractiveGuideline = false
, tooltips = true
, tooltip = function(key, x, y, e, graph) {
return '<h3>' + key + '</h3>' +
@ -36,9 +31,6 @@ nv.models.stackedAreaChart = function() {
, noData = 'No Data Available.'
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
, controlWidth = 250
, cData = ['Stacked','Stream','Expanded']
, controlLabels = {}
, transitionDuration = 250
;
xAxis
@ -46,10 +38,15 @@ nv.models.stackedAreaChart = function() {
.tickPadding(7)
;
yAxis
.orient((rightAlignYAxis) ? 'right' : 'left')
.orient('left')
;
stacked.scatter
.pointActive(function(d) {
//console.log(stacked.y()(d), !!Math.round(stacked.y()(d) * 100));
return !!Math.round(stacked.y()(d) * 100);
})
;
controls.updateState(false);
//============================================================
@ -80,7 +77,7 @@ nv.models.stackedAreaChart = function() {
availableHeight = (height || parseInt(container.style('height')) || 400)
- margin.top - margin.bottom;
chart.update = function() { container.transition().duration(transitionDuration).call(chart); };
chart.update = function() { chart(selection) };
chart.container = this;
//set state.disabled
@ -137,22 +134,21 @@ nv.models.stackedAreaChart = function() {
var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedAreaChart').append('g');
var g = wrap.select('g');
gEnter.append("rect").style("opacity",0);
gEnter.append('g').attr('class', 'nv-x nv-axis');
gEnter.append('g').attr('class', 'nv-y nv-axis');
gEnter.append('g').attr('class', 'nv-stackedWrap');
gEnter.append('g').attr('class', 'nv-legendWrap');
gEnter.append('g').attr('class', 'nv-controlsWrap');
gEnter.append('g').attr('class', 'nv-interactive');
g.select("rect").attr("width",availableWidth).attr("height",availableHeight);
//------------------------------------------------------------
//------------------------------------------------------------
// Legend
if (showLegend) {
var legendWidth = (showControls) ? availableWidth - controlWidth : availableWidth;
legend
.width(legendWidth);
.width( availableWidth - controlWidth );
g.select('.nv-legendWrap')
.datum(data)
@ -165,7 +161,7 @@ nv.models.stackedAreaChart = function() {
}
g.select('.nv-legendWrap')
.attr('transform', 'translate(' + (availableWidth-legendWidth) + ',' + (-margin.top) +')');
.attr('transform', 'translate(' + controlWidth + ',' + (-margin.top) +')');
}
//------------------------------------------------------------
@ -176,38 +172,11 @@ nv.models.stackedAreaChart = function() {
if (showControls) {
var controlsData = [
{
key: controlLabels.stacked || 'Stacked',
metaKey: 'Stacked',
disabled: stacked.style() != 'stack',
style: 'stack'
},
{
key: controlLabels.stream || 'Stream',
metaKey: 'Stream',
disabled: stacked.style() != 'stream',
style: 'stream'
},
{
key: controlLabels.expanded || 'Expanded',
metaKey: 'Expanded',
disabled: stacked.style() != 'expand',
style: 'expand'
},
{
key: controlLabels.stack_percent || 'Stack %',
metaKey: 'Stack_Percent',
disabled: stacked.style() != 'stack_percent',
style: 'stack_percent'
}
{ key: 'Stacked', disabled: stacked.offset() != 'zero' },
{ key: 'Stream', disabled: stacked.offset() != 'wiggle' },
{ key: 'Expanded', disabled: stacked.offset() != 'expand' }
];
controlWidth = (cData.length/3) * 260;
controlsData = controlsData.filter(function(d) {
return cData.indexOf(d.metaKey) !== -1;
})
controls
.width( controlWidth )
.color(['#444', '#444', '#444']);
@ -233,34 +202,18 @@ nv.models.stackedAreaChart = function() {
wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
if (rightAlignYAxis) {
g.select(".nv-y.nv-axis")
.attr("transform", "translate(" + availableWidth + ",0)");
}
//------------------------------------------------------------
// Main Chart Component(s)
//------------------------------------------------------------
//Set up interactive layer
if (useInteractiveGuideline) {
interactiveLayer
.width(availableWidth)
.height(availableHeight)
.margin({left: margin.left, top: margin.top})
.svgContainer(container)
.xScale(x);
wrap.select(".nv-interactive").call(interactiveLayer);
}
stacked
.width(availableWidth)
.height(availableHeight)
var stackedWrap = g.select('.nv-stackedWrap')
.datum(data);
stackedWrap.transition().call(stacked);
//d3.transition(stackedWrap).call(stacked);
stackedWrap.call(stacked);
//------------------------------------------------------------
@ -268,32 +221,28 @@ nv.models.stackedAreaChart = function() {
//------------------------------------------------------------
// Setup Axes
if (showXAxis) {
xAxis
.scale(x)
.ticks( availableWidth / 100 )
.tickSize( -availableHeight, 0);
g.select('.nv-x.nv-axis')
.attr('transform', 'translate(0,' + availableHeight + ')');
g.select('.nv-x.nv-axis')
.transition().duration(0)
.call(xAxis);
}
if (showYAxis) {
yAxis
.scale(y)
.ticks(stacked.offset() == 'wiggle' ? 0 : availableHeight / 36)
.tickSize(-availableWidth, 0)
.setTickFormat( (stacked.style() == 'expand' || stacked.style() == 'stack_percent')
? d3.format('%') : yAxisTickFormat);
g.select('.nv-y.nv-axis')
.transition().duration(0)
.call(yAxis);
}
xAxis
.scale(x)
.ticks( availableWidth / 100 )
.tickSize( -availableHeight, 0);
g.select('.nv-x.nv-axis')
.attr('transform', 'translate(0,' + availableHeight + ')');
//d3.transition(g.select('.nv-x.nv-axis'))
g.select('.nv-x.nv-axis')
.transition().duration(0)
.call(xAxis);
yAxis
.scale(y)
.ticks(stacked.offset() == 'wiggle' ? 0 : availableHeight / 36)
.tickSize(-availableWidth, 0)
.setTickFormat(stacked.offset() == 'expand' ? d3.format('%') : yAxisTickFormat);
//d3.transition(g.select('.nv-y.nv-axis'))
g.select('.nv-y.nv-axis')
.transition().duration(0)
.call(yAxis);
//------------------------------------------------------------
@ -304,24 +253,38 @@ nv.models.stackedAreaChart = function() {
stacked.dispatch.on('areaClick.toggle', function(e) {
if (data.filter(function(d) { return !d.disabled }).length === 1)
data.forEach(function(d) {
data = data.map(function(d) {
d.disabled = false;
return d
});
else
data.forEach(function(d,i) {
data = data.map(function(d,i) {
d.disabled = (i != e.seriesIndex);
return d
});
state.disabled = data.map(function(d) { return !!d.disabled });
dispatch.stateChange(state);
chart.update();
//selection.transition().call(chart);
chart(selection);
});
legend.dispatch.on('stateChange', function(newState) {
state.disabled = newState.disabled;
legend.dispatch.on('legendClick', function(d,i) {
d.disabled = !d.disabled;
if (!data.filter(function(d) { return !d.disabled }).length) {
data.map(function(d) {
d.disabled = false;
return d;
});
}
state.disabled = data.map(function(d) { return !!d.disabled });
dispatch.stateChange(state);
chart.update();
//selection.transition().call(chart);
chart(selection);
});
controls.dispatch.on('legendClick', function(d,i) {
@ -333,93 +296,25 @@ nv.models.stackedAreaChart = function() {
});
d.disabled = false;
stacked.style(d.style);
switch (d.key) {
case 'Stacked':
stacked.style('stack');
break;
case 'Stream':
stacked.style('stream');
break;
case 'Expanded':
stacked.style('expand');
break;
}
state.style = stacked.style();
dispatch.stateChange(state);
chart.update();
//selection.transition().call(chart);
chart(selection);
});
interactiveLayer.dispatch.on('elementMousemove', function(e) {
stacked.clearHighlights();
var singlePoint, pointIndex, pointXLocation, allData = [];
data
.filter(function(series, i) {
series.seriesIndex = i;
return !series.disabled;
})
.forEach(function(series,i) {
pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x());
stacked.highlightPoint(i, pointIndex, true);
var point = series.values[pointIndex];
if (typeof point === 'undefined') return;
if (typeof singlePoint === 'undefined') singlePoint = point;
if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex));
//If we are in 'expand' mode, use the stacked percent value instead of raw value.
var tooltipValue = (stacked.style() == 'expand') ? point.display.y : chart.y()(point,pointIndex);
allData.push({
key: series.key,
value: tooltipValue,
color: color(series,series.seriesIndex),
stackedValue: point.display
});
});
allData.reverse();
//Highlight the tooltip entry based on which stack the mouse is closest to.
if (allData.length > 2) {
var yValue = chart.yScale().invert(e.mouseY);
var yDistMax = Infinity, indexToHighlight = null;
allData.forEach(function(series,i) {
//To handle situation where the stacked area chart is negative, we need to use absolute values
//when checking if the mouse Y value is within the stack area.
yValue = Math.abs(yValue);
var stackedY0 = Math.abs(series.stackedValue.y0);
var stackedY = Math.abs(series.stackedValue.y);
if ( yValue >= stackedY0 && yValue <= (stackedY + stackedY0))
{
indexToHighlight = i;
return;
}
});
if (indexToHighlight != null)
allData[indexToHighlight].highlight = true;
}
var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));
//If we are in 'expand' mode, force the format to be a percentage.
var valueFormatter = (stacked.style() == 'expand') ?
function(d,i) {return d3.format(".1%")(d);} :
function(d,i) {return yAxis.tickFormat()(d); };
interactiveLayer.tooltip
.position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
.chartContainer(that.parentNode)
.enabled(tooltips)
.valueFormatter(valueFormatter)
.data(
{
value: xValue,
series: allData
}
)();
interactiveLayer.renderGuideLine(pointXLocation);
});
interactiveLayer.dispatch.on("elementMouseout",function(e) {
dispatch.tooltipHide();
stacked.clearHighlights();
});
dispatch.on('tooltipShow', function(e) {
if (tooltips) showTooltip(e, that.parentNode);
});
@ -427,7 +322,7 @@ nv.models.stackedAreaChart = function() {
// Update chart from a state object passed to event handler
dispatch.on('changeState', function(e) {
if (typeof e.disabled !== 'undefined' && data.length === e.disabled.length) {
if (typeof e.disabled !== 'undefined') {
data.forEach(function(series,i) {
series.disabled = e.disabled[i];
});
@ -439,7 +334,7 @@ nv.models.stackedAreaChart = function() {
stacked.style(e.style);
}
chart.update();
selection.call(chart);
});
});
@ -489,11 +384,8 @@ nv.models.stackedAreaChart = function() {
chart.controls = controls;
chart.xAxis = xAxis;
chart.yAxis = yAxis;
chart.interactiveLayer = interactiveLayer;
d3.rebind(chart, stacked, 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'interactive', 'useVoronoi', 'offset', 'order', 'style', 'clipEdge', 'forceX', 'forceY', 'forceSize', 'interpolate');
chart.options = nv.utils.optionsFunc.bind(chart);
d3.rebind(chart, stacked, 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'sizeDomain', 'interactive', 'offset', 'order', 'style', 'clipEdge', 'forceX', 'forceY', 'forceSize', 'interpolate');
chart.margin = function(_) {
if (!arguments.length) return margin;
@ -505,13 +397,13 @@ nv.models.stackedAreaChart = function() {
};
chart.width = function(_) {
if (!arguments.length) return width;
if (!arguments.length) return getWidth;
width = _;
return chart;
};
chart.height = function(_) {
if (!arguments.length) return height;
if (!arguments.length) return getHeight;
height = _;
return chart;
};
@ -536,35 +428,6 @@ nv.models.stackedAreaChart = function() {
return chart;
};
chart.showXAxis = function(_) {
if (!arguments.length) return showXAxis;
showXAxis = _;
return chart;
};
chart.showYAxis = function(_) {
if (!arguments.length) return showYAxis;
showYAxis = _;
return chart;
};
chart.rightAlignYAxis = function(_) {
if(!arguments.length) return rightAlignYAxis;
rightAlignYAxis = _;
yAxis.orient( (_) ? 'right' : 'left');
return chart;
};
chart.useInteractiveGuideline = function(_) {
if(!arguments.length) return useInteractiveGuideline;
useInteractiveGuideline = _;
if (_ === true) {
chart.interactive(false);
chart.useVoronoi(false);
}
return chart;
};
chart.tooltip = function(_) {
if (!arguments.length) return tooltip;
tooltip = _;
@ -601,25 +464,6 @@ nv.models.stackedAreaChart = function() {
return chart;
};
chart.transitionDuration = function(_) {
if (!arguments.length) return transitionDuration;
transitionDuration = _;
return chart;
};
chart.controlsData = function(_) {
if (!arguments.length) return cData;
cData = _;
return chart;
};
chart.controlLabels = function(_) {
if (!arguments.length) return controlLabels;
if (typeof _ !== 'object') return controlLabels;
controlLabels = _;
return chart;
};
yAxis.setTickFormat = yAxis.tickFormat;
yAxis.tickFormat = function(_) {
@ -628,7 +472,6 @@ nv.models.stackedAreaChart = function() {
return yAxis;
};
//============================================================
return chart;

@ -10,18 +10,6 @@
overflow: hidden;
}
/********************
Box shadow and border radius styling
*/
.nvtooltip.with-3d-shadow, .with-3d-shadow .nvtooltip {
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
box-shadow: 0 5px 10px rgba(0,0,0,.2);
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}
/********************
* TOOLTIP CSS
@ -29,17 +17,31 @@
.nvtooltip {
position: absolute;
background-color: rgba(255,255,255,1.0);
background-color: rgba(255,255,255,1);
padding: 1px;
border: 1px solid rgba(0,0,0,.2);
z-index: 10000;
font-family: Arial;
font-size: 13px;
text-align: left;
pointer-events: none;
white-space: nowrap;
transition: opacity 500ms linear;
-moz-transition: opacity 500ms linear;
-webkit-transition: opacity 500ms linear;
transition-delay: 500ms;
-moz-transition-delay: 500ms;
-webkit-transition-delay: 500ms;
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
box-shadow: 0 5px 10px rgba(0,0,0,.2);
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
pointer-events: none;
-webkit-touch-callout: none;
-webkit-user-select: none;
@ -49,19 +51,6 @@
user-select: none;
}
/*Give tooltips that old fade in transition by
putting a "with-transitions" class on the container div.
*/
.nvtooltip.with-transitions, .with-transitions .nvtooltip {
transition: opacity 250ms linear;
-moz-transition: opacity 250ms linear;
-webkit-transition: opacity 250ms linear;
transition-delay: 250ms;
-moz-transition-delay: 250ms;
-webkit-transition-delay: 250ms;
}
.nvtooltip.x-nvtooltip,
.nvtooltip.y-nvtooltip {
padding: 8px;
@ -72,7 +61,7 @@
padding: 4px 14px;
line-height: 18px;
font-weight: normal;
background-color: rgba(247,247,247,0.75);
background-color: #f7f7f7;
text-align: center;
border-bottom: 1px solid #ebebeb;
@ -93,45 +82,6 @@
margin: 2px 0;
}
.nvtooltip table {
margin: 6px;
border-spacing:0;
}
.nvtooltip table td {
padding: 2px 9px 2px 0;
vertical-align: middle;
}
.nvtooltip table td.key {
font-weight:normal;
}
.nvtooltip table td.value {
text-align: right;
font-weight: bold;
}
.nvtooltip table tr.highlight td {
padding: 1px 9px 1px 0;
border-bottom-style: solid;
border-bottom-width: 1px;
border-top-style: solid;
border-top-width: 1px;
}
.nvtooltip table td.legend-color-guide div {
width: 8px;
height: 8px;
vertical-align: middle;
}
.nvtooltip .footer {
padding: 3px;
text-align: center;
}
.nvtooltip-pending-removal {
position: absolute;
pointer-events: none;
@ -207,9 +157,6 @@ svg .title {
/**********
* Axes
*/
.nvd3 .nv-axis {
pointer-events:none;
}
.nvd3 .nv-axis path {
fill: none;
@ -228,12 +175,12 @@ svg .title {
.nvd3 .nv-axis line {
fill: none;
stroke: #e5e5e5;
stroke: #000;
stroke-opacity: .25;
shape-rendering: crispEdges;
}
.nvd3 .nv-axis .zero line,
/*this selector may not be necessary*/ .nvd3 .nv-axis line.zero {
.nvd3 .nv-axis line.zero {
stroke-opacity: .75;
}
@ -277,7 +224,7 @@ svg .title {
-webkit-transition: fill-opacity 250ms linear;
}
.nvd3 .nv-bars rect.hover {
.nvd3 .nv-bars rect:hover {
fill-opacity: 1;
}
@ -327,6 +274,7 @@ svg .title {
.nvd3.nv-pie path {
stroke-opacity: 0;
transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
-moz-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
-webkit-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
@ -346,10 +294,12 @@ svg .title {
.nvd3.nv-pie .hover path {
fill-opacity: .7;
/*
stroke-width: 6px;
stroke-opacity: 1;
*/
}
.nvd3.nv-pie .nv-label {
pointer-events: none;
}
.nvd3.nv-pie .nv-label rect {
fill-opacity: 0;
stroke-opacity: 0;
@ -361,7 +311,7 @@ svg .title {
.nvd3 .nv-groups path.nv-line {
fill: none;
stroke-width: 1.5px;
stroke-width: 2.5px;
/*
stroke-linecap: round;
shape-rendering: geometricPrecision;
@ -376,11 +326,6 @@ svg .title {
*/
}
.nvd3 .nv-groups path.nv-line.nv-thin-line {
stroke-width: 1px;
}
.nvd3 .nv-groups path.nv-area {
stroke: none;
/*
@ -420,18 +365,17 @@ svg .title {
}
.with-transitions .nvd3 .nv-groups .nv-point {
.nvd3 .nv-groups .nv-point {
transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
-moz-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
-webkit-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
}
.nvd3.nv-scatter .nv-groups .nv-point.hover,
.nvd3 .nv-groups .nv-point.hover {
stroke-width: 7px;
fill-opacity: .95 !important;
stroke-opacity: .95 !important;
stroke-width: 20px;
fill-opacity: .5 !important;
stroke-opacity: .5 !important;
}
@ -528,12 +472,11 @@ svg .title {
fill-opacity: 0;
}
/*
.nvd3.nv-stackedarea .nv-groups .nv-point.hover {
stroke-width: 20px;
stroke-opacity: .75;
fill-opacity: 1;
}*/
}
@ -568,7 +511,7 @@ svg .title {
.nvd3.nv-bullet .nv-range {
fill: #bababa;
fill: #999;
fill-opacity: .4;
}
.nvd3.nv-bullet .nv-range:hover {
@ -756,14 +699,4 @@ svg .title {
.nvd3 .axis text {
text-shadow: 0 1px 0 #fff;
}
/****
Interactive Layer
*/
.nvd3 .nv-interactiveGuideLine {
pointer-events:none;
}
.nvd3 line.nv-guideline {
stroke: #ccc;
}

@ -1,490 +1,133 @@
/* Tooltip rendering model for nvd3 charts.
window.nv.models.tooltip is the updated,new way to render tooltips.
window.nv.tooltip.show is the old tooltip code.
window.nv.tooltip.* also has various helper methods.
*/
(function() {
"use strict";
window.nv.tooltip = {};
/* Model which can be instantiated to handle tooltip rendering.
Example usage:
var tip = nv.models.tooltip().gravity('w').distance(23)
.data(myDataObject);
tip(); //just invoke the returned function to render tooltip.
*/
window.nv.models.tooltip = function() {
var content = null //HTML contents of the tooltip. If null, the content is generated via the data variable.
, data = null /* Tooltip data. If data is given in the proper format, a consistent tooltip is generated.
Format of data:
{
key: "Date",
value: "August 2009",
series: [
{
key: "Series 1",
value: "Value 1",
color: "#000"
},
{
key: "Series 2",
value: "Value 2",
color: "#00f"
}
]
}
*/
, gravity = 'w' //Can be 'n','s','e','w'. Determines how tooltip is positioned.
, distance = 50 //Distance to offset tooltip from the mouse location.
, snapDistance = 25 //Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect)
, fixedTop = null //If not null, this fixes the top position of the tooltip.
, classes = null //Attaches additional CSS classes to the tooltip DIV that is created.
, chartContainer = null //Parent DIV, of the SVG Container that holds the chart.
, tooltipElem = null //actual DOM element representing the tooltip.
, position = {left: null, top: null} //Relative position of the tooltip inside chartContainer.
, enabled = true //True -> tooltips are rendered. False -> don't render tooltips.
//Generates a unique id when you create a new tooltip() object
, id = "nvtooltip-" + Math.floor(Math.random() * 100000)
;
//CSS class to specify whether element should not have mouse events.
var nvPointerEventsClass = "nv-pointer-events-none";
//Format function for the tooltip values column
var valueFormatter = function(d,i) {
return d;
};
//Format function for the tooltip header value.
var headerFormatter = function(d) {
return d;
};
//By default, the tooltip model renders a beautiful table inside a DIV.
//You can override this function if a custom tooltip is desired.
var contentGenerator = function(d) {
if (content != null) return content;
if (d == null) return '';
var table = d3.select(document.createElement("table"));
var theadEnter = table.selectAll("thead")
.data([d])
.enter().append("thead");
theadEnter.append("tr")
.append("td")
.attr("colspan",3)
.append("strong")
.classed("x-value",true)
.html(headerFormatter(d.value));
var tbodyEnter = table.selectAll("tbody")
.data([d])
.enter().append("tbody");
var trowEnter = tbodyEnter.selectAll("tr")
.data(function(p) { return p.series})
.enter()
.append("tr")
.classed("highlight", function(p) { return p.highlight})
;
trowEnter.append("td")
.classed("legend-color-guide",true)
.append("div")
.style("background-color", function(p) { return p.color});
trowEnter.append("td")
.classed("key",true)
.html(function(p) {return p.key});
trowEnter.append("td")
.classed("value",true)
.html(function(p,i) { return valueFormatter(p.value,i) });
trowEnter.selectAll("td").each(function(p) {
if (p.highlight) {
var opacityScale = d3.scale.linear().domain([0,1]).range(["#fff",p.color]);
var opacity = 0.6;
d3.select(this)
.style("border-bottom-color", opacityScale(opacity))
.style("border-top-color", opacityScale(opacity))
;
}
});
var html = table.node().outerHTML;
if (d.footer !== undefined)
html += "<div class='footer'>" + d.footer + "</div>";
return html;
};
var dataSeriesExists = function(d) {
if (d && d.series && d.series.length > 0) return true;
return false;
};
//In situations where the chart is in a 'viewBox', re-position the tooltip based on how far chart is zoomed.
function convertViewBoxRatio() {
if (chartContainer) {
var svg = d3.select(chartContainer);
if (svg.node().tagName !== "svg") {
svg = svg.select("svg");
}
var viewBox = (svg.node()) ? svg.attr('viewBox') : null;
if (viewBox) {
viewBox = viewBox.split(' ');
var ratio = parseInt(svg.style('width')) / viewBox[2];
position.left = position.left * ratio;
position.top = position.top * ratio;
}
}
}
//Creates new tooltip container, or uses existing one on DOM.
function getTooltipContainer(newContent) {
var body;
if (chartContainer)
body = d3.select(chartContainer);
else
body = d3.select("body");
var container = body.select(".nvtooltip");
if (container.node() === null) {
//Create new tooltip div if it doesn't exist on DOM.
container = body.append("div")
.attr("class", "nvtooltip " + (classes? classes: "xy-tooltip"))
.attr("id",id)
;
}
container.node().innerHTML = newContent;
container.style("top",0).style("left",0).style("opacity",0);
container.selectAll("div, table, td, tr").classed(nvPointerEventsClass,true)
container.classed(nvPointerEventsClass,true);
return container.node();
}
//Draw the tooltip onto the DOM.
function nvtooltip() {
if (!enabled) return;
if (!dataSeriesExists(data)) return;
convertViewBoxRatio();
var left = position.left;
var top = (fixedTop != null) ? fixedTop : position.top;
var container = getTooltipContainer(contentGenerator(data));
tooltipElem = container;
if (chartContainer) {
var svgComp = chartContainer.getElementsByTagName("svg")[0];
var boundRect = (svgComp) ? svgComp.getBoundingClientRect() : chartContainer.getBoundingClientRect();
var svgOffset = {left:0,top:0};
if (svgComp) {
var svgBound = svgComp.getBoundingClientRect();
var chartBound = chartContainer.getBoundingClientRect();
var svgBoundTop = svgBound.top;
//Defensive code. Sometimes, svgBoundTop can be a really negative
// number, like -134254. That's a bug.
// If such a number is found, use zero instead. FireFox bug only
if (svgBoundTop < 0) {
var containerBound = chartContainer.getBoundingClientRect();
svgBoundTop = (Math.abs(svgBoundTop) > containerBound.height) ? 0 : svgBoundTop;
}
svgOffset.top = Math.abs(svgBoundTop - chartBound.top);
svgOffset.left = Math.abs(svgBound.left - chartBound.left);
}
//If the parent container is an overflow <div> with scrollbars, subtract the scroll offsets.
//You need to also add any offset between the <svg> element and its containing <div>
//Finally, add any offset of the containing <div> on the whole page.
left += chartContainer.offsetLeft + svgOffset.left - 2*chartContainer.scrollLeft;
top += chartContainer.offsetTop + svgOffset.top - 2*chartContainer.scrollTop;
}
if (snapDistance && snapDistance > 0) {
top = Math.floor(top/snapDistance) * snapDistance;
}
nv.tooltip.calcTooltipPosition([left,top], gravity, distance, container);
return nvtooltip;
};
nvtooltip.nvPointerEventsClass = nvPointerEventsClass;
nvtooltip.content = function(_) {
if (!arguments.length) return content;
content = _;
return nvtooltip;
};
/*****
* A no-frills tooltip implementation.
*****/
//Returns tooltipElem...not able to set it.
nvtooltip.tooltipElem = function() {
return tooltipElem;
};
nvtooltip.contentGenerator = function(_) {
if (!arguments.length) return contentGenerator;
if (typeof _ === 'function') {
contentGenerator = _;
}
return nvtooltip;
};
nvtooltip.data = function(_) {
if (!arguments.length) return data;
data = _;
return nvtooltip;
};
nvtooltip.gravity = function(_) {
if (!arguments.length) return gravity;
gravity = _;
return nvtooltip;
};
nvtooltip.distance = function(_) {
if (!arguments.length) return distance;
distance = _;
return nvtooltip;
};
nvtooltip.snapDistance = function(_) {
if (!arguments.length) return snapDistance;
snapDistance = _;
return nvtooltip;
};
nvtooltip.classes = function(_) {
if (!arguments.length) return classes;
classes = _;
return nvtooltip;
};
nvtooltip.chartContainer = function(_) {
if (!arguments.length) return chartContainer;
chartContainer = _;
return nvtooltip;
};
(function() {
nvtooltip.position = function(_) {
if (!arguments.length) return position;
position.left = (typeof _.left !== 'undefined') ? _.left : position.left;
position.top = (typeof _.top !== 'undefined') ? _.top : position.top;
return nvtooltip;
};
var nvtooltip = window.nv.tooltip = {};
nvtooltip.fixedTop = function(_) {
if (!arguments.length) return fixedTop;
fixedTop = _;
return nvtooltip;
};
nvtooltip.show = function(pos, content, gravity, dist, parentContainer, classes) {
nvtooltip.enabled = function(_) {
if (!arguments.length) return enabled;
enabled = _;
return nvtooltip;
};
var container = document.createElement('div');
container.className = 'nvtooltip ' + (classes ? classes : 'xy-tooltip');
nvtooltip.valueFormatter = function(_) {
if (!arguments.length) return valueFormatter;
if (typeof _ === 'function') {
valueFormatter = _;
gravity = gravity || 's';
dist = dist || 20;
var body = parentContainer;
if ( !parentContainer || parentContainer.tagName.match(/g|svg/i)) {
//If the parent element is an SVG element, place tooltip in the <body> element.
body = document.getElementsByTagName('body')[0];
}
container.innerHTML = content;
container.style.left = 0;
container.style.top = 0;
container.style.opacity = 0;
body.appendChild(container);
var height = parseInt(container.offsetHeight),
width = parseInt(container.offsetWidth),
windowWidth = nv.utils.windowSize().width,
windowHeight = nv.utils.windowSize().height,
scrollTop = window.scrollY,
scrollLeft = window.scrollX,
left, top;
windowHeight = window.innerWidth >= document.body.scrollWidth ? windowHeight : windowHeight - 16;
windowWidth = window.innerHeight >= document.body.scrollHeight ? windowWidth : windowWidth - 16;
var tooltipTop = function ( Elem ) {
var offsetTop = top;
do {
if( !isNaN( Elem.offsetTop ) ) {
offsetTop += (Elem.offsetTop);
}
return nvtooltip;
};
nvtooltip.headerFormatter = function(_) {
if (!arguments.length) return headerFormatter;
if (typeof _ === 'function') {
headerFormatter = _;
} while( Elem = Elem.offsetParent );
return offsetTop;
}
var tooltipLeft = function ( Elem ) {
var offsetLeft = left;
do {
if( !isNaN( Elem.offsetLeft ) ) {
offsetLeft += (Elem.offsetLeft);
}
return nvtooltip;
};
//id() is a read-only function. You can't use it to set the id.
nvtooltip.id = function() {
return id;
};
return nvtooltip;
} while( Elem = Elem.offsetParent );
return offsetLeft;
}
switch (gravity) {
case 'e':
left = pos[0] - width - dist;
top = pos[1] - (height / 2);
var tLeft = tooltipLeft(container);
var tTop = tooltipTop(container);
if (tLeft < scrollLeft) left = pos[0] + dist > scrollLeft ? pos[0] + dist : scrollLeft - tLeft + left;
if (tTop < scrollTop) top = scrollTop - tTop + top;
if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
break;
case 'w':
left = pos[0] + dist;
top = pos[1] - (height / 2);
if (tLeft + width > windowWidth) left = pos[0] - width - dist;
if (tTop < scrollTop) top = scrollTop + 5;
if (tTop + height > scrollTop + windowHeight) top = scrollTop - height - 5;
break;
case 'n':
left = pos[0] - (width / 2) - 5;
top = pos[1] + dist;
var tLeft = tooltipLeft(container);
var tTop = tooltipTop(container);
if (tLeft < scrollLeft) left = scrollLeft + 5;
if (tLeft + width > windowWidth) left = left - width/2 + 5;
if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
break;
case 's':
left = pos[0] - (width / 2);
top = pos[1] - height - dist;
var tLeft = tooltipLeft(container);
var tTop = tooltipTop(container);
if (tLeft < scrollLeft) left = scrollLeft + 5;
if (tLeft + width > windowWidth) left = left - width/2 + 5;
if (scrollTop > tTop) top = scrollTop;
break;
}
container.style.left = left+'px';
container.style.top = top+'px';
container.style.opacity = 1;
container.style.position = 'absolute'; //fix scroll bar issue
container.style.pointerEvents = 'none'; //fix scroll bar issue
return container;
};
nvtooltip.cleanup = function() {
//Original tooltip.show function. Kept for backward compatibility.
// pos = [left,top]
nv.tooltip.show = function(pos, content, gravity, dist, parentContainer, classes) {
//Create new tooltip div if it doesn't exist on DOM.
var container = document.createElement('div');
container.className = 'nvtooltip ' + (classes ? classes : 'xy-tooltip');
// Find the tooltips, mark them for removal by this class (so others cleanups won't find it)
var tooltips = document.getElementsByClassName('nvtooltip');
var purging = [];
while(tooltips.length) {
purging.push(tooltips[0]);
tooltips[0].style.transitionDelay = '0 !important';
tooltips[0].style.opacity = 0;
tooltips[0].className = 'nvtooltip-pending-removal';
}
var body = parentContainer;
if ( !parentContainer || parentContainer.tagName.match(/g|svg/i)) {
//If the parent element is an SVG element, place tooltip in the <body> element.
body = document.getElementsByTagName('body')[0];
}
container.style.left = 0;
container.style.top = 0;
container.style.opacity = 0;
container.innerHTML = content;
body.appendChild(container);
//If the parent container is an overflow <div> with scrollbars, subtract the scroll offsets.
if (parentContainer) {
pos[0] = pos[0] - parentContainer.scrollLeft;
pos[1] = pos[1] - parentContainer.scrollTop;
}
nv.tooltip.calcTooltipPosition(pos, gravity, dist, container);
};
//Looks up the ancestry of a DOM element, and returns the first NON-svg node.
nv.tooltip.findFirstNonSVGParent = function(Elem) {
while(Elem.tagName.match(/^g|svg$/i) !== null) {
Elem = Elem.parentNode;
}
return Elem;
};
setTimeout(function() {
//Finds the total offsetTop of a given DOM element.
//Looks up the entire ancestry of an element, up to the first relatively positioned element.
nv.tooltip.findTotalOffsetTop = function ( Elem, initialTop ) {
var offsetTop = initialTop;
do {
if( !isNaN( Elem.offsetTop ) ) {
offsetTop += (Elem.offsetTop);
}
} while( Elem = Elem.offsetParent );
return offsetTop;
while (purging.length) {
var removeMe = purging.pop();
removeMe.parentNode.removeChild(removeMe);
}
}, 500);
};
//Finds the total offsetLeft of a given DOM element.
//Looks up the entire ancestry of an element, up to the first relatively positioned element.
nv.tooltip.findTotalOffsetLeft = function ( Elem, initialLeft) {
var offsetLeft = initialLeft;
do {
if( !isNaN( Elem.offsetLeft ) ) {
offsetLeft += (Elem.offsetLeft);
}
} while( Elem = Elem.offsetParent );
return offsetLeft;
};
//Global utility function to render a tooltip on the DOM.
//pos = [left,top] coordinates of where to place the tooltip, relative to the SVG chart container.
//gravity = how to orient the tooltip
//dist = how far away from the mouse to place tooltip
//container = tooltip DIV
nv.tooltip.calcTooltipPosition = function(pos, gravity, dist, container) {
var height = parseInt(container.offsetHeight),
width = parseInt(container.offsetWidth),
windowWidth = nv.utils.windowSize().width,
windowHeight = nv.utils.windowSize().height,
scrollTop = window.pageYOffset,
scrollLeft = window.pageXOffset,
left, top;
windowHeight = window.innerWidth >= document.body.scrollWidth ? windowHeight : windowHeight - 16;
windowWidth = window.innerHeight >= document.body.scrollHeight ? windowWidth : windowWidth - 16;
gravity = gravity || 's';
dist = dist || 20;
var tooltipTop = function ( Elem ) {
return nv.tooltip.findTotalOffsetTop(Elem, top);
};
var tooltipLeft = function ( Elem ) {
return nv.tooltip.findTotalOffsetLeft(Elem,left);
};
switch (gravity) {
case 'e':
left = pos[0] - width - dist;
top = pos[1] - (height / 2);
var tLeft = tooltipLeft(container);
var tTop = tooltipTop(container);
if (tLeft < scrollLeft) left = pos[0] + dist > scrollLeft ? pos[0] + dist : scrollLeft - tLeft + left;
if (tTop < scrollTop) top = scrollTop - tTop + top;
if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
break;
case 'w':
left = pos[0] + dist;
top = pos[1] - (height / 2);
var tLeft = tooltipLeft(container);
var tTop = tooltipTop(container);
if (tLeft + width > windowWidth) left = pos[0] - width - dist;
if (tTop < scrollTop) top = scrollTop + 5;
if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
break;
case 'n':
left = pos[0] - (width / 2) - 5;
top = pos[1] + dist;
var tLeft = tooltipLeft(container);
var tTop = tooltipTop(container);
if (tLeft < scrollLeft) left = scrollLeft + 5;
if (tLeft + width > windowWidth) left = left - width/2 + 5;
if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height;
break;
case 's':
left = pos[0] - (width / 2);
top = pos[1] - height - dist;
var tLeft = tooltipLeft(container);
var tTop = tooltipTop(container);
if (tLeft < scrollLeft) left = scrollLeft + 5;
if (tLeft + width > windowWidth) left = left - width/2 + 5;
if (scrollTop > tTop) top = scrollTop;
break;
case 'none':
left = pos[0];
top = pos[1] - dist;
var tLeft = tooltipLeft(container);
var tTop = tooltipTop(container);
break;
}
container.style.left = left+'px';
container.style.top = top+'px';
container.style.opacity = 1;
container.style.position = 'absolute';
return container;
};
//Global utility function to remove tooltips from the DOM.
nv.tooltip.cleanup = function() {
// Find the tooltips, mark them for removal by this class (so others cleanups won't find it)
var tooltips = document.getElementsByClassName('nvtooltip');
var purging = [];
while(tooltips.length) {
purging.push(tooltips[0]);
tooltips[0].style.transitionDelay = '0 !important';
tooltips[0].style.opacity = 0;
tooltips[0].className = 'nvtooltip-pending-removal';
}
setTimeout(function() {
while (purging.length) {
var removeMe = purging.pop();
removeMe.parentNode.removeChild(removeMe);
}
}, 500);
};
})();

@ -30,7 +30,6 @@ nv.utils.windowSize = function() {
// Easy way to bind multiple functions to window.onresize
// TODO: give a way to remove a function after its bound, other than removing all of them
nv.utils.windowResize = function(fun){
if (fun === undefined) return;
var oldresize = window.onresize;
window.onresize = function(e) {
@ -105,49 +104,15 @@ nv.utils.pjax = function(links, content) {
}
/* For situations where we want to approximate the width in pixels for an SVG:text element.
Most common instance is when the element is in a display:none; container.
Most common instance is when the element is in a display:none; container.
Forumla is : text.length * font-size * constant_factor
*/
nv.utils.calcApproxTextWidth = function (svgTextElem) {
if (typeof svgTextElem.style === 'function'
&& typeof svgTextElem.text === 'function') {
if (svgTextElem instanceof d3.selection) {
var fontSize = parseInt(svgTextElem.style("font-size").replace("px",""));
var textLength = svgTextElem.text().length;
return textLength * fontSize * 0.5;
return textLength * fontSize * 0.5;
}
return 0;
};
/* Numbers that are undefined, null or NaN, convert them to zeros.
*/
nv.utils.NaNtoZero = function(n) {
if (typeof n !== 'number'
|| isNaN(n)
|| n === null
|| n === Infinity) return 0;
return n;
};
/*
Snippet of code you can insert into each nv.models.* to give you the ability to
do things like:
chart.options({
showXAxis: true,
tooltips: true
});
To enable in the chart:
chart.options = nv.utils.optionsFunc.bind(chart);
*/
nv.utils.optionsFunc = function(args) {
if (args) {
d3.map(args).forEach((function(key,value) {
if (typeof this[key] === "function") {
this[key](value);
}
}).bind(this));
}
return this;
};

@ -1,256 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
<link href="teststyle.css" rel="stylesheet" type='text/css'>
<body>
<div style='position:relative;' class='with-transitions'>
<h3>Scatter chart tests</h3>
<div class='navigation'>
Tests:
<a href="lineChartTest.html">Line Chart</a>
<a href="stackedAreaChartTest.html">Stacked Area</a>
<a href="../examples/cumulativeLineChart.html">Cumulative Line</a>
<a href="ScatterChartTest.html">Scatter</a>
<a href="interactiveBisectTest.html">nv.interactiveBisect unit tests</a>
</div>
<div id="test1" class="chart third">
Normal - four series', all random (40 points)
<button>Select chart</button>
<svg></svg>
</div>
<div id="test2" class="chart third">
Normal - one series', all random (5 points), zero left margin
<button>Select chart</button>
<svg></svg>
</div>
<div id="test3" class="chart third">
Zero right margin, 200 points
<button>Select chart</button>
<svg></svg>
</div>
<div id="test4" class="chart third">
Bigger margins
<button>Select chart</button>
<svg></svg>
</div>
<div id="test5" class="chart third">
Zero data points
<button>Select chart</button>
<svg></svg>
</div>
<div id="test6" class="chart third">
One point.
<button>Select chart</button>
<svg></svg>
</div>
<div id="test7" class="chart third">
Two points
<button>Select chart</button>
<svg></svg>
</div>
<div id="test8" class="chart third">
Three series', one point each
<button>Select chart</button>
<svg></svg>
</div>
<div id="test9" class="chart third">
Three series', first one has zero points
<button>Select chart</button>
<svg></svg>
</div>
<div id="test10" class="chart third">
Lots of series
<button>Select chart</button>
<svg></svg>
</div>
<div id="test11" class="chart third">
Scatter plus line: y=2x + 0
<button>Select chart</button>
<svg></svg>
</div>
<div id="test12" class="chart third">
Scatter plus line: y=2x + 10;
<button>Select chart</button>
<svg></svg>
</div>
<div id="test13" class="chart third">
Scatter plus line: y=-0.5x + 1.0;
<button>Select chart</button>
<svg></svg>
</div>
<div id="test14" class="chart third">
Scatter chart: duplicate y values
<button>Select chart</button>
<svg></svg>
</div>
<div id="test15" class="chart third">
Scatter chart: duplicate x values
<button>Select chart</button>
<svg></svg>
</div>
<div id="test16" class="chart third">
Scatter chart: extremely small data points (1e-10)
<button>Select chart</button>
<svg></svg>
</div>
</div>
<script src="../lib/d3.v3.js"></script>
<!--<script src="../lib/fisheye.js"></script>-->
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/axis.js"></script>
<script src="../src/models/distribution.js"></script>
<script src="../src/models/scatter.js"></script>
<script src="../src/models/scatterChart.js"></script>
<script src="../src/models/scatterPlusLineChart.js"></script>
<script src="testScript.js"></script>
<script>
defaultChartTest("test1", randomData(4,40));
defaultChartTest("test2", randomData(1,5), {left:0});
defaultChartTest("test3", randomData(2,200), {right: 0});
defaultChartTest("test4", randomData(2, 8), {top:40, right: 90, bottom: 150, left: 150});
defaultChartTest("test5", randomData(0,0));
defaultChartTest("test6", randomData(1,1));
defaultChartTest("test7", randomData(1,2));
defaultChartTest("test8", randomData(3,1));
defaultChartTest("test9", [
{key: "Group 0", values: []},
{key: "Group 1", values: [{x:1, y:1}]}
]);
defaultChartTest("test10", randomData(30,2));
scatterPlusLineTest("test11", randomDataSloped(2,0));
scatterPlusLineTest("test12", randomDataSloped(2,10));
scatterPlusLineTest("test13", randomDataSloped(-0.5,1));
defaultChartTest("test14", [
{key: "Duplicate Y",
values: [
{x: 0, y: 10}, {x:1, y:10},{x:2, y:10},{x:3, y:10}
]
}
]);
defaultChartTest("test15",[
{key: "Duplicate X",
area: true,
values: [
{x: 4, y: 10},
{x: 4, y: 11},
{x: 4, y: 12},
{x: 4, y: 13}
]
}
]);
defaultChartTest("test16",tinyPoints());
function defaultChartTest(container, data, margin) {
nv.addGraph(function() {
var chart;
chart = nv.models.scatterChart()
.showDistX(true).showDistY(true)
;
chart.xAxis.tickFormat(d3.format('.02f'));
chart.yAxis.tickFormat(d3.format('.02f'));
if (margin) {
chart.margin(margin);
}
chart.tooltipContent(function(key) {
return "<h3>" + key + "</h3>";
});
d3.select('#' + container + ' svg').datum(data).transition().duration(500).call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
}
function scatterPlusLineTest(container, data) {
nv.addGraph(function() {
var chart;
chart = nv.models.scatterPlusLineChart()
.showDistX(true).showDistY(true);
chart.xAxis.tickFormat(d3.format('.02f'));
chart.yAxis.tickFormat(d3.format('.02f'));
chart.tooltipContent(function(key) {
return "<h3>" + key + "</h3>";
});
d3.select('#' + container + ' svg').datum(data).transition().duration(500).call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
}
function randomData(groups, points) { //# groups,# points per group
var data = [],
shapes = ['circle', 'cross', 'triangle-up', 'triangle-down', 'diamond', 'square'],
random = d3.random.normal();
for (i = 0; i < groups; i++) {
data.push({
key: 'Group ' + i,
values: []
});
for (j = 0; j < points; j++) {
data[i].values.push({
x: random(),
y: random(),
size: Math.random(),
shape: shapes[j % 6]
});
}
}
return data;
}
function randomDataSloped(slope,intercept) { //# groups,# points per group
var data = [],
shapes = ['circle', 'cross', 'triangle-up', 'triangle-down', 'diamond', 'square'],
random = d3.random.normal();
var groups = 2, points = 10;
for (i = 0; i < groups; i++) {
data.push({
key: 'Group ' + i,
values: [],
slope: slope,
intercept: intercept
});
for (j = 0; j < points; j++) {
data[i].values.push({
x: random(),
y: random(),
size: Math.random(),
shape: shapes[j % 6]
});
}
}
return data;
}
function tinyPoints() {
var rval = {key: "Tiny points", values: []};
for(var i =1; i < 20; i++) {
rval.values.push({
x: Math.random() * 1e-10,
y: Math.random() * 1e-10
});
}
return [rval];
}
</script>

@ -1,158 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
<link href="teststyle.css" rel="stylesheet" type='text/css'>
<body>
<h3>Unit tests for nv.interactiveBisect - this function is important for rendering tooltips and the guideline on charts.</h3>
<div class='navigation'>
Tests:
<a href="lineChartTest.html">Line Chart</a>
<a href="stackedAreaChartTest.html">Stacked Area</a>
<a href="../examples/cumulativeLineChart.html">Cumulative Line</a>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/interactiveLayer.js"></script>
<script>
function runTest(description, dataArray, searchVal, expectedResult, xAccessor) {
var result = nv.interactiveBisect(dataArray, searchVal, xAccessor);
var content = "";
if (result === expectedResult) {
content = "PASSED: " + description;
}
else {
content = "FAILED: " + description;
}
var node = document.createElement("div");
node.innerHTML = content;
document.getElementsByTagName("body")[0].appendChild(node);
}
var x = function(d) {return d;};
runTest("Basic test",
[0,1,2,3,4,5],
3,
3,
x
);
runTest("Basic test - zero bound",
[0,1,2,3,4,5],
0,
0,
x
);
runTest("Basic test - length bound",
[0,1,2,3,4,5],
5,
5,
x
);
runTest("Basic test - negative number",
[0,1,2,3,4,5],
-4,
0,
x
);
runTest("Basic test - past the end",
[0,1,2,3,4,5],
10,
5,
x
);
runTest("Floating point number",
[0,1,2,3,4,5],
0.34,
0,
x
);
runTest("Floating point number part 2",
[0,1,2,3,4,5],
1.50001,
2,
x
);
runTest("Fibonacci - existing item search",
[0,1,1,2,3,5,8,13,21,34],
8,
6,
x
);
runTest("Fibonacci - inbetween item (left)",
[0,1,1,2,3,5,8,13,21,34],
15,
7,
x
);
runTest("Fibonacci - inbetween item (right)",
[0,1,1,2,3,5,8,13,21,34],
20,
8,
x
);
x = function(d,i) { return i};
runTest("xAccessor is index mode - existing item",
[0,1,1,2,3,5,8,13,21,34],
7,
7,
x
);
runTest("xAccessor is index mode - inbetween item",
[0,1,1,2,3,5,8,13,21,34],
7.3,
7,
x
);
runTest("xAccessor is index mode - inbetween item part 2",
[0,1,1,2,3,5,8,13,21,34],
7.500001,
8,
x
);
runTest("Empty array",
[],
4,
0,
x
);
runTest("Single element array",
[0],
0,
0,
x
);
runTest("Single element array - negative bound",
[0],
-10,
0,
x
);
runTest("Single element array - past the end",
[0],
1,
0,
x
);
</script>

@ -1,475 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
<link href="teststyle.css" rel="stylesheet" type='text/css'>
<style>
#chart13, #chart14 {
overflow: scroll;
width: 500px;
height: 300px;
}
#chart13 svg, #chart14 svg {
width: 700px;
height: 400px;
}
</style>
<body>
<h3>Line chart test cases - feel free to add more tests</h3>
<div style='position:relative;'>
<div class='navigation'>
Tests:
<a href="lineChartTest.html">Line Chart</a>
<a href="stackedAreaChartTest.html">Stacked Area</a>
<a href="../examples/cumulativeLineChart.html">Cumulative Line</a>
<a href="ScatterChartTest.html">Scatter</a>
<a href="pieChartTest.html">Pie chart</a>
<a href="realTimeChartTest.html">Real time test</a>
<a href="polylinearTest.html">Polylinear test</a>
<a href="interactiveBisectTest.html">nv.interactiveBisect unit tests</a>
</div>
<div class='chart full' id='chart1'>
Example of chart with many series', and new interactive guideline plus tooltip. A chunk of data was purposely removed
to show how the chart handles it.
<button>Select chart</button>
<svg></svg>
</div>
<div class='chart half with-transitions' id='chart2'>
Chart with old tooltip style (with-transitions).
<button>Select chart</button>
<svg></svg>
</div>
<div class='chart half' id='chart3'>
Chart with three data points.
<button>Select chart</button>
<svg></svg>
</div>
<div class='chart third' id='chart4'>
Chart where two series have different number of points.
<button>Select chart</button>
<svg></svg>
</div>
<div class='chart third' id='chart5'>
Chart with one point.
<button>Select chart</button>
<svg></svg>
</div>
<div class='chart third' id='chart6'>
Chart with 1000 points.
<button>Select chart</button>
<svg></svg>
</div>
<div class='chart third' id='chart7'>
Chart with no data.
<button>Select chart</button>
<svg></svg>
</div>
<div class='chart third' id='chart8'>
All points random. No order.
<button>Select chart</button>
<svg></svg>
</div>
<div class='chart third' id='chart9'>
Points do not increase linearly.
<button>Select chart</button>
<svg></svg>
</div>
<div class='chart third' id='chart10'>
Chart with 15 series'
<button>Select chart</button>
<svg></svg>
</div>
<div class='chart third' id='chart11'>
Data points go backwards
<button>Select chart</button>
<svg></svg>
</div>
<div class='chart third' id='chart12'>
Duplicate X coordinate points.
<button>Select chart</button>
<svg></svg>
</div>
<div class='chart third' id='chart16'>
Duplicate Y coordinate points.
<button>Select chart</button>
<svg></svg>
</div>
<div class='chart third' id='chart13'>
Chart in a overflow div with scrolls (new tooltips)
<button>Select chart</button>
<svg></svg>
</div>
<div class='chart third' id='chart14'>
Chart in a overflow div with scrolls (old tooltips)
<button>Select chart</button>
<svg></svg>
</div>
<div style='clear:both;'></div>
<div class='chart third' id='chart15'>
What if there are null, Infinity and NaN values in points?
<button>Select chart</button>
<svg></svg>
</div>
<div class='chart third' id='chart17'>
Chart with very small, 1e-10, points (old tooltips)
<button>Select chart</button>
<svg></svg>
</div>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/interactiveLayer.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/axis.js"></script>
<script src="../src/models/scatter.js"></script>
<script src="../src/models/line.js"></script>
<script src="../src/models/lineChart.js"></script>
<script src="testScript.js"></script>
<script>
d3.select("body").on("keydown",function() {
if (d3.event.ctrlKey && d3.event.which === 75) {
alert("keydowned");
}
});
//------------ CHART 1
defaultChartConfig("chart1", dummyStocks(),true, true, {forceY:false});
//-------------- CHART 2 --- Chart without the interactive guideline.
nv.addGraph(function() {
var chart;
chart = nv.models.lineChart().useInteractiveGuideline(false);
chart
.x(function(d,i) { return d.x });
chart.xAxis // chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately
.tickFormat(d3.format(',.1f'));
chart.yAxis
.axisLabel('Voltage (v)')
.tickFormat(d3.format(',.4f'));
chart.showXAxis(true).showYAxis(true).rightAlignYAxis(true).margin({right: 90});
d3.select('#chart2 svg')
//.datum([]) //for testing noData
.datum(dummyStocks(50))
.transition().duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
defaultChartConfig("chart3", smallDataSet(3));
defaultChartConfig("chart4", badDataSet());
defaultChartConfig("chart5", smallDataSet(1));
defaultChartConfig("chart6", normalDist());
defaultChartConfig("chart7", smallDataSet(0));
defaultChartConfig("chart8", allRandom(),false);
defaultChartConfig("chart9", fibonacci());
defaultChartConfig("chart10", lotsofSeries());
defaultChartConfig("chart11", backwards(),false);
defaultChartConfig("chart12", duplicateX(),false);
defaultChartConfig("chart13",hyperbole(), true, false, {width: 700, height: 400});
defaultChartConfig("chart14",hyperbole(), false, false, {width: 700, height: 400});
defaultChartConfig("chart15", withNaNs());
defaultChartConfig("chart16", duplicateY(), false);
defaultChartConfig("chart17", tinyPoints(), false);
function defaultChartConfig(containerid, data, guideline, useDates, auxOptions) {
if (auxOptions === undefined) auxOptions = {};
if (guideline === undefined) guideline = true;
nv.addGraph(function() {
var chart;
chart = nv.models.lineChart().useInteractiveGuideline(guideline);
chart
.x(function(d,i) {
return d.x;
});
if (auxOptions.width)
chart.width(auxOptions.width);
if (auxOptions.height)
chart.height(auxOptions.height);
if (auxOptions.forceY)
chart.forceY([0]);
var formatter;
if (useDates !== undefined) {
formatter = function(d,i) {
var now = (new Date()).getTime() - 86400 * 1000 * 365;
now = new Date(now + d * 86400 * 1000);
return d3.time.format('%b %d %Y')(now );
}
}
else {
formatter = d3.format(",.1f");
}
chart.margin({right: 40});
chart.xAxis // chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately
.tickFormat(
formatter
);
chart.yAxis
.axisLabel('Voltage (v)')
.tickFormat(d3.format(',.2f'));
d3.select('#' + containerid + ' svg')
.datum(data)
.transition().duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
}
function sinAndCos() {
var sin = [],
cos = [],
rand = [],
rand2 = []
;
var now = (new Date()).getTime();
for (var i = 0; i < 100; i++) {
sin.push({x: i, y: i % 10 == 5 ? null : Math.sin(i/10) }); //the nulls are to show how defined works
cos.push({x: i, y: .5 * Math.cos(i/10)});
rand.push({x:i, y: Math.random() / 10});
rand2.push({x: i, y: Math.cos(i/10) + Math.random() / 10 })
}
return [
{
area: true,
values: sin,
key: "Sine Wave",
color: "#ff7f0e"
},
{
values: cos,
key: "Cosine Wave",
color: "#2ca02c"
},
{
values: rand,
key: "Random Points",
color: "#2222ff"
}
,
{
values: rand2,
key: "Random Cosine",
color: "#667711"
}
];
}
function hyperbole() {
var series1 = [], series2 = [], series3 = [];
for(var i = 1; i < 100; i++) {
series1.push({x: i, y: 1 / i});
series2.push({x: i, y: 5 / i});
series3.push({x: i, y: -8 / i});
}
return [
{values: series1, key: "Series 1"},
{values: series2, key: "Series 2"},
{values: series3, key: "Series 3"}
];
}
function smallDataSet(n) {
var series = [];
for(var i = 0; i < n; i++) {
series.push({x: i, y: i * 0.3 + 2})
}
return [
{values: series, key: "Line 1"}
];
}
function badDataSet() {
var series1 = [], series2 = [];
for(var i =0; i < 30; i++) {
series1.push({x:i, y: i*0.3 + 12});
}
for(i = 0; i < 30; i += 5) {
series2.push({x:i, y: i*0.7 + 8});
}
return [
{values: series1, key:"Series 1"},
{values: series2, key:"Series 2"}
];
}
function normalDist() {
var series1 = [], series2 = [];
for(var i = -500; i < 500; i += 1) {
var x = i / 100;
var y = 0.3989 * Math.pow(2.71, -0.5*x*x);
series1.push({x:i, y:y});
series2.push({x:i, y:y*2});
}
return [
{values: series1, key:"Normal 1", area:true},
{values: series2, key:"Normal 2"}];
}
function allRandom() {
var series = [];
for(var i = 0; i < 20; i++) {
series.push({x: Math.floor(Math.random()*20), y: Math.floor(Math.random()*20) });
}
return [{values: series,area:true, key: "Total Chaos"}];
}
function fibonacci() {
var series = [
{x:1, y:1},
{x:2, y:2.5},
{x:3, y:4},
{x:5, y:6.7},
{x:8, y:10.1},
{x:13, y:20.1},
{x:21, y:35.1},
{x:34, y:60.0},
{x:55, y:70.9},
{x:89, y:100.3}
];
return [{values: series,area:true,color: "#22fb88", key: "Fibonacci"}];
}
function lotsofSeries() {
var rval = [];
for(var n = 0; n < 15; n++) {
var values = [];
var slope = Math.random() * 5;
for(var i =0; i < 30; i++) {
values.push(
{x: i,
y: i * slope + Math.random()*5}
);
}
var isArea = (Math.random() > 0.5);
rval.push({key: "Series " + n, area: isArea, values: values});
}
return rval;
}
function backwards() {
var series = [];
for(var i = 30; i >= 1; i--) {
series.push({x: i, y: Math.sqrt(i) });
}
return [{values: series, key: "Backwards series", area:true}];
}
function duplicateX() {
return [
{key: "Duplicate X",
area: true,
values: [
{x: 4, y: 10},
{x: 4, y: 11},
{x: 4, y: 12},
{x: 4, y: 13}
]
}
];
}
function duplicateY() {
return [
{key: "Duplicate Y",
values: [
{x: 0, y: 10}, {x:1, y:10},{x:2, y:10},{x:3, y:10}
]
}
];
}
function withNaNs() {
return [
{key: "NaN Points",
values: [
{x: 1, y: NaN},
{x: 2, y: undefined},
{x: 3, y: false},
{x: 4, y: null},
{x: 5, y: "Hello"},
{x: NaN, y: NaN},
{x: null, y: null},
{x: undefined, y: undefined},
{x: "Hello", y: "World"},
{x: Infinity, y: Infinity}
]
}
]
}
function tinyPoints() {
var rval = {key: "Tiny points", values: []};
for(var i =1; i < 20; i++) {
rval.values.push({
x: i,
y: Math.random() * 1e-10
});
}
return [rval];
}
function dummyStocks(numPoints) {
numPoints = numPoints || 200;
function volatileChart(key,startPrice, volatility, isArea) {
var rval = {key: key, values: []};
if (isArea) rval.area = true;
for(var i = 1; i < numPoints; i++) {
rval.values.push({x: i, y: (i > 110 && i < 130) ? null : startPrice});
var rnd = Math.random();
var changePct = 2 * volatility * rnd;
if ( changePct > volatility) {
changePct -= (2*volatility);
}
startPrice = startPrice + startPrice * changePct;
}
return rval;
}
var stocks = [];
stocks.push(volatileChart("APPL",5.00, 0.02));
stocks.push(volatileChart("GOOG", 6.01,0.024));
stocks.push(volatileChart("MSFT", 2.01, 0.012));
stocks.push(volatileChart("IBM US", 2.5, 0.08, true));
return stocks;
}
</script>

@ -1,148 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
<link href="teststyle.css" rel="stylesheet" type='text/css'>
<body class='with-3d-shadow with-transitions'>
<h3>Multibar chart test cases - feel free to add more tests</h3>
<div class='navigation'>
<a href="../examples/multiBar.html">Multibar Stream example</a>
</div>
<div class='chart half' id="chart1">
Normal chart, with transition delay, and bar color set.
<svg></svg>
</div>
<div class='chart half' id="chart2">
Normal chart, no transitionDuration or delay, no bar color set.
<svg></svg>
</div>
<div class='chart half' id="chart3">
Chart with single series, no group spacing.
<svg></svg>
</div>
<div class='chart half' id="chart4">
Chart with 18 series, 7 data points per series.
<svg></svg>
</div>
<div class='chart third' id="chart5">
Chart with 1 data point
<svg></svg>
</div>
<div class='chart third' id="chart6">
Chart with 2 data points
<svg></svg>
</div>
<div class='chart third' id="chart7">
Chart with 0 data points
<svg></svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/axis.js"></script>
<script src="../src/models/multiBar.js"></script>
<script src="../src/models/multiBarChart.js"></script>
<script>
var negative_test_data = new d3.range(0,3).map(function(d,i) { return {
key: 'Stream ' + i,
values: new d3.range(0,11).map( function(f,j) {
return {
y: 10 + Math.random()*100 * (Math.floor(Math.random()*100)%2 ? 1 : -1),
x: j
}
})
};
});
function dataFactory(seriesNum, perSeries) {
return new d3.range(0,seriesNum).map(function(d,i) { return {
key: 'Stream ' + i,
values: new d3.range(0,perSeries).map( function(f,j) {
return {
y: 10 + Math.random()*100,
x: j
}
})
};
});
}
defaultChartConfig("chart1", negative_test_data, {
barColor: d3.scale.category20().range(),
delay: 1200,
groupSpacing: 0.1,
reduceXTicks: false,
staggerLabels: true
});
defaultChartConfig("chart2", dataFactory(3,11), {
delay: 0,
transitionDuration:0,
groupSpacing: 0.2
});
defaultChartConfig("chart3",dataFactory(1,15),{
groupSpacing: 0,
delay:0
});
defaultChartConfig("chart4",dataFactory(18,7),{
delay:800
});
defaultChartConfig("chart5",dataFactory(1,1),{
delay:0
});
defaultChartConfig("chart6",dataFactory(1,2),{
delay:0
});
defaultChartConfig("chart7",dataFactory(0,0),{
delay:0
});
function defaultChartConfig(containerId, data, chartOptions) {
nv.addGraph(function() {
var chart;
chart = nv.models.multiBarChart()
.margin({bottom: 100})
.transitionDuration(300)
;
chart.options(chartOptions);
chart.multibar
.hideable(true);
chart.xAxis
.axisLabel("Current Index")
.showMaxMin(true)
.tickFormat(d3.format(',0f'));
chart.yAxis
.tickFormat(d3.format(',.1f'));
d3.select('#' + containerId + ' svg')
.datum(data)
.call(chart);
nv.utils.windowResize(chart.update);
chart.dispatch.on('stateChange', function(e) { nv.log('New State:', JSON.stringify(e)); });
return chart;
});
}
</script>

@ -1,177 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
<link href="teststyle.css" rel="stylesheet" type='text/css'>
<style>
body {
overflow-y:scroll;
font-family: Arial;
}
text {
font: 12px sans-serif;
}
</style>
<body class='with-transitions'>
<div class='navigation'>
Tests:
<a href="lineChartTest.html">Line Chart</a>
<a href="stackedAreaChartTest.html">Stacked Area</a>
<a href="../examples/cumulativeLineChart.html">Cumulative Line</a>
<a href="ScatterChartTest.html">Scatter</a>
<a href="realTimeChartTest.html">Real time test</a>
</div>
<div class='chart third' id="test1">
<h2>Standard Pie Chart</h2>
<svg></svg>
</div>
<div class='chart third' id="test2">
<h2>Donut pie chart</h2>
<svg></svg>
</div>
<div class='chart third' id="test3">
<h2>Pie chart with 30 series'</h2>
<svg></svg>
</div>
<div class='chart third' id='test7'>
<h2>Pie chart with percent label type</h2>
<svg></svg>
</div>
<div class='chart third' id="test4">
<h2>Empty array passed in</h2>
<svg></svg>
</div>
<div class='chart third' id="test5">
<h2>Series' have only zero values</h2>
<svg></svg>
</div>
<div class='chart third' id="test6">
<h2>NaN, null, undefined values passed in</h2>
<svg></svg>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/pie.js"></script>
<script src="../src/models/pieChart.js"></script>
<script src="../src/utils.js"></script>
<script>
var testdata = [
{
key: "One",
y: 5
},
{
key: "Two",
y: 2
},
{
key: "Three",
y: 9
},
{
key: "Four",
y: 7
},
{
key: "Five",
y: 4
},
{
key: "Six",
y: 3
},
{
key: "Seven",
y: .5
}
];
function thirtySeries() {
var data = [];
for(var i =0; i < 30; i++) {
data.push({
key: "Series-" + i,
y: Math.floor(Math.random() * 100)
});
}
return data;
}
function defaultChart(containerId, data, labelType) {
nv.addGraph(function() {
var width = 500,
height = 500;
var chart = nv.models.pieChart()
.x(function(d) { return d.key })
.y(function(d) { return d.y })
.color(d3.scale.category10().range())
.width(width)
.height(height)
.labelType(labelType)
;
d3.select("#" + containerId + " svg")
.datum(data)
.transition().duration(1200)
.attr('width', width)
.attr('height', height)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
}
//Adds donut pie chart.
nv.addGraph(function() {
var width = 500,
height = 500;
var chart = nv.models.pieChart()
.x(function(d) { return d.key })
.color(d3.scale.category10().range())
.width(width)
.height(height)
.donut(true);
chart.pie
.startAngle(function(d) { return d.startAngle/2 -Math.PI/2 })
.endAngle(function(d) { return d.endAngle/2 -Math.PI/2 });
d3.select("#test2 svg")
.datum(testdata)
.transition().duration(1200)
.attr('width', width)
.attr('height', height)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
defaultChart("test1", testdata);
defaultChart("test3", thirtySeries());
defaultChart("test4",[]);
defaultChart("test5",[{key: "Zero series", y: 0}, {key: "Zero series 2", y: 0}]);
defaultChart("test6", [
{key: "Undefined", y: undefined},
{key: "Nan", y: NaN},
{key: "null", y: null},
{key: "zero", y: 0}
])
defaultChart("test7",testdata, "percent");
</script>

@ -1,192 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
<link href="teststyle.css" rel="stylesheet" type='text/css'>
<style>
</style>
<body>
<h3>Test cases for Domain and Range overrides - Example of a polylinear scale</h3>
<div style='position:relative;'>
<div class='navigation'>
Tests:
<a href="lineChartTest.html">Line Chart</a>
<a href="stackedAreaChartTest.html">Stacked Area</a>
<a href="../examples/cumulativeLineChart.html">Cumulative Line</a>
<a href="ScatterChartTest.html">Scatter</a>
<a href="pieChartTest.html">Pie chart</a>
</div>
<div class='chart full' id='chart1'>
Line chart: yDomain = [0,2,200], yRange = [500,50,0]
<svg></svg>
</div>
<div class='chart half with-transitions' id='chart2'>
Historical bar chart: yDomain = [0,2,130], yRange = [500,50,0]
<svg></svg>
</div>
<div class='half'>
Notes:
The chart.yRange() and chart.xRange() properties are an advanced feature. They are useful
in situations where your data has wild extremes: ie, you have lots of smaller numbers, and lots of really big numbers.<br/><br/>
Without a polylinear scale, those really big data points will overwhelm the small points.<br/><br/>
Please look at the examples to understand how polylinear scales work. Comment/uncomment the lines that alter yDomain and yRange
to see the effect it has on the charts.
</div>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/interactiveLayer.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/axis.js"></script>
<script src="../src/models/scatter.js"></script>
<script src="../src/models/line.js"></script>
<script src="../src/models/lineChart.js"></script>
<script src="../src/models/historicalBar.js"></script>
<script src="../src/models/historicalBarChart.js"></script>
<script>
//------------ CHART 1
lineChartConfig("chart1", sinAndCos(),true, false);
barChartConfig(dataWithSpikes());
function lineChartConfig(containerid, data, guideline, useDates, auxOptions) {
if (auxOptions === undefined) auxOptions = {};
if (guideline === undefined) guideline = true;
nv.addGraph(function() {
var chart;
chart = nv.models.lineChart().useInteractiveGuideline(guideline);
var fullChartHeight = 500 - chart.margin().top - chart.margin().bottom;
chart
.x(function(d,i) {
return d.x;
})
.yDomain([0,2,200]) //Using a polylinear scale
.yRange([fullChartHeight,50,0])
;
if (auxOptions.width)
chart.width(auxOptions.width);
if (auxOptions.height)
chart.height(auxOptions.height);
var formatter;
if (useDates) {
formatter = function(d,i) {
var now = (new Date()).getTime() - 86400 * 1000 * 365;
now = new Date(now + d * 86400 * 1000);
return d3.time.format('%b %d %Y')(now );
}
}
else {
formatter = d3.format(",.1f");
}
chart.xAxis // chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately
.tickFormat(
formatter
);
chart.yAxis
.axisLabel('Voltage (v)')
.tickFormat(d3.format(',.2f'));
d3.select('#' + containerid + ' svg')
.datum(data)
.transition().duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
}
function barChartConfig(data) {
nv.addGraph(function() {
var chart = nv.models.historicalBarChart();
var fullChartHeight = 500 - chart.margin().top - chart.margin().bottom;
chart.color(["#ff7f0e"])
.yDomain([0,2,130])
.yRange([fullChartHeight,50,0])
.transitionDuration(500)
;
chart.xAxis
.tickFormat(d3.format(',.1f'))
.axisLabel("Time")
;
chart.yAxis
.axisLabel('Random Number')
.tickFormat(d3.format(',.4f'));
d3.select("#chart2 svg")
.datum(data)
.transition().duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
}
function sinAndCos() {
var sin = [],
cos = [],
higherOrder = []
;
var now = (new Date()).getTime();
for (var i = 0; i < 100; i++) {
sin.push({x: i, y: Math.abs(Math.sin(i/10)) }); //the nulls are to show how defined works
cos.push({x: i, y: Math.abs(.5 * Math.cos(i/10)) });
higherOrder.push({x: i, y: Math.cos(i) * 100 + 100});
}
return [
{
values: sin,
key: "Sine Wave",
color: "#ff7f0e"
},
{
values: cos,
key: "Cosine Wave",
color: "#2ca02c"
},
{
values: higherOrder,
key: "Higher Order",
color: "#fc34ff"
}
];
}
function dataWithSpikes() {
var rval = [];
for(var i =0; i < 100; i++) {
var spike = (Math.random() > 0.9);
rval.push({
x: i,
y: (spike) ? Math.random() * 100 + 30 : Math.random()
});
}
return [
{key: "Series 1",
color : "orange",
values: rval}
];
}
</script>

@ -1,102 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
<link href="teststyle.css" rel="stylesheet" type='text/css'>
<body>
<div class='navigation'>
Tests:
<a href="lineChartTest.html">Line Chart</a>
<a href="stackedAreaChartTest.html">Stacked Area</a>
<a href="../examples/cumulativeLineChart.html">Cumulative Line</a>
<a href="ScatterChartTest.html">Scatter</a>
</div>
<h3>Example showing real time chart updating</h3>
The chart below is a historical bar chart, which is ideal for visualizing time series data.<br/>
First, you need to update the data model for the chart. In the example, we append a random number
every half a second. Then, you call <strong>chart.update()</strong>.
<div id='chart' class='chart half with-transitions'>
<svg></svg>
<button id='start-stop-button'>Start/Stop Stream</button>
</div>
<script src="../lib/d3.v3.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/interactiveLayer.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/axis.js"></script>
<script src="../src/models/scatter.js"></script>
<script src="../src/models/line.js"></script>
<script src="../src/models/lineChart.js"></script>
<script src="../src/models/historicalBar.js"></script>
<script src="../src/models/historicalBarChart.js"></script>
<script>
var chart;
var data = [{
key: "Stream 1",
color: "orange",
values: [
{x: 1, y: 1}
]
}];
nv.addGraph(function() {
chart = nv.models.historicalBarChart();
chart
.x(function(d,i) { return d.x });
chart.xAxis // chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately
.tickFormat(d3.format(',.1f'))
.axisLabel("Time")
;
chart.yAxis
.axisLabel('Random Number')
.tickFormat(d3.format(',.4f'));
chart.showXAxis(true).showYAxis(true).rightAlignYAxis(true).margin({right: 90});
d3.select('#chart svg')
.datum(data)
.transition().duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
var x = 2;
var run = true;
setInterval(function(){
if (!run) return;
var spike = (Math.random() > 0.95) ? 10: 1;
data[0].values.push({
x: x,
y: Math.random() * spike
});
if (data[0].values.length > 70) {
data[0].values.shift();
}
x++;
chart.update();
}, 500);
d3.select("#start-stop-button").on("click",function() {
run = !run;
});
</script>
</body>
</html>

@ -1,322 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
<link href="teststyle.css" rel="stylesheet" type='text/css'>
<body>
<h3>Stacked area chart test cases - feel free to add more tests</h3>
<div class='navigation'>
Tests:
<a href="lineChartTest.html">Line Chart</a>
<a href="stackedAreaChartTest.html">Stacked Area</a>
<a href="../examples/cumulativeLineChart.html">Cumulative Line</a>
</div>
<div class='chart full' id='chart1'>Full chart example with new tooltip and guideline<button>Select chart</button><svg></svg></div>
<div class='chart half with-transitions' id='chart2'>Chart with old tooltips (with-transitions)<button>Select chart</button><svg></svg></div>
<div class='chart half' id='chart3'>Chart with single point<button>Select chart</button><svg></svg></div>
<div class='chart half' id='chart4'>Chart with two points<button>Select chart</button><svg></svg></div>
<div class='chart half' id='chart5'>Chart with 'holes'<button>Select chart</button><svg></svg></div>
<div class='chart half' id='chart6'>Total random points<button>Select chart</button><svg></svg></div>
<div class='chart half' id='chart7'>Less than four points, old tooltips<button>Select chart</button><svg></svg></div>
<div class='chart half' id='chart8'>No data<svg></svg></div>
<div class='chart half' id='chart9'>Data is all negative<svg></svg></div>
<script src="../lib/d3.v3.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/models/axis.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/interactiveLayer.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/axis.js"></script>
<script src="../src/models/scatter.js"></script>
<script src="../src/models/stackedArea.js"></script>
<script src="../src/models/stackedAreaChart.js"></script>
<script src="testScript.js"></script>
<script>
var histcatexplong = [
{
"key" : "Consumer Discretionary" ,
"values" : [ [ 1138683600000 , 27.38478809681] , [ 1141102800000 , 27.371377218208] , [ 1143781200000 , 26.309915460827] , [ 1146369600000 , 26.425199957521] , [ 1149048000000 , 26.823411519395] , [ 1151640000000 , 23.850443591584] , [ 1154318400000 , 23.158355444054] , [ 1156996800000 , 22.998689393694] , [ 1159588800000 , 27.977128511299] , [ 1162270800000 , 29.073672469721] , [ 1164862800000 , 28.587640408904] , [ 1167541200000 , 22.788453687638] , [ 1170219600000 , 22.429199073597] , [ 1172638800000 , 22.324103271051] , [ 1175313600000 , 17.558388444186] , [ 1177905600000 , 16.769518096208] , [ 1180584000000 , 16.214738201302] , [ 1183176000000 , 18.729632971228] , [ 1185854400000 , 18.814523318848] , [ 1188532800000 , 19.789986451358] , [ 1191124800000 , 17.070049054933] , [ 1193803200000 , 16.121349575715] , [ 1196398800000 , 15.141659430091] , [ 1199077200000 , 17.175388025298] , [ 1201755600000 , 17.286592443521] , [ 1204261200000 , 16.323141626569] , [ 1206936000000 , 19.231263773952] , [ 1209528000000 , 18.446256391094] , [ 1212206400000 , 17.822632399764] , [ 1214798400000 , 15.539366475979] , [ 1217476800000 , 15.255131790216] , [ 1220155200000 , 15.660963922593] , [ 1222747200000 , 13.254482273697] , [ 1225425600000 , 11.920796202299] , [ 1228021200000 , 12.122809090925] , [ 1230699600000 , 15.691026271393] , [ 1233378000000 , 14.720881635107] , [ 1235797200000 , 15.387939360044] , [ 1238472000000 , 13.765436672229] , [ 1241064000000 , 14.6314458648] , [ 1243742400000 , 14.292446536221] , [ 1246334400000 , 16.170071367016] , [ 1249012800000 , 15.948135554337] , [ 1251691200000 , 16.612872685134] , [ 1254283200000 , 18.778338719091] , [ 1256961600000 , 16.75602606542] , [ 1259557200000 , 19.385804443147] , [ 1262235600000 , 22.950590240168] , [ 1264914000000 , 23.61159018141] , [ 1267333200000 , 25.708586989581] , [ 1270008000000 , 26.883915999885] , [ 1272600000000 , 25.893486687065] , [ 1275278400000 , 24.678914263176] , [ 1277870400000 , 25.937275793023] , [ 1280548800000 , 29.46138169384] , [ 1283227200000 , 27.357322961862] , [ 1285819200000 , 29.057235285673] , [ 1288497600000 , 28.549434189386] , [ 1291093200000 , 28.506352379723] , [ 1293771600000 , 29.449241421597] , [ 1296450000000 , 25.796838168807] , [ 1298869200000 , 28.740145449189] , [ 1301544000000 , 22.091744141872] , [ 1304136000000 , 25.079662545409] , [ 1306814400000 , 23.674906973064] , [ 1309406400000 , 23.41800274293] , [ 1312084800000 , 23.243644138871] , [ 1314763200000 , 31.591854066817] , [ 1317355200000 , 31.497112374114] , [ 1320033600000 , 26.672380820431] , [ 1322629200000 , 27.297080015495] , [ 1325307600000 , 20.174315530051] , [ 1327986000000 , 19.631084213899] , [ 1330491600000 , 20.366462219462] , [ 1333166400000 , 17.429019937289] , [ 1335758400000 , 16.75543633539] , [ 1338436800000 , 16.182906906042]]
} ,
{
"key" : "Consumer Staples" ,
"values" : [ [ 1138683600000 , 7.2800122043237] , [ 1141102800000 , 7.1187787503354] , [ 1143781200000 , 8.351887016482] , [ 1146369600000 , 8.4156698763993] , [ 1149048000000 , 8.1673298604231] , [ 1151640000000 , 5.5132447126042] , [ 1154318400000 , 6.1152537710599] , [ 1156996800000 , 6.076765091942] , [ 1159588800000 , 4.6304473798646] , [ 1162270800000 , 4.6301068469402] , [ 1164862800000 , 4.3466656309389] , [ 1167541200000 , 6.830104897003] , [ 1170219600000 , 7.241633040029] , [ 1172638800000 , 7.1432372054153] , [ 1175313600000 , 10.608942063374] , [ 1177905600000 , 10.914964549494] , [ 1180584000000 , 10.933223880565] , [ 1183176000000 , 8.3457524851265] , [ 1185854400000 , 8.1078413081882] , [ 1188532800000 , 8.2697185922474] , [ 1191124800000 , 8.4742436475968] , [ 1193803200000 , 8.4994601179319] , [ 1196398800000 , 8.7387319683243] , [ 1199077200000 , 6.8829183612895] , [ 1201755600000 , 6.984133637885] , [ 1204261200000 , 7.0860136043287] , [ 1206936000000 , 4.3961787956053] , [ 1209528000000 , 3.8699674365231] , [ 1212206400000 , 3.6928925238305] , [ 1214798400000 , 6.7571718894253] , [ 1217476800000 , 6.4367313362344] , [ 1220155200000 , 6.4048441521454] , [ 1222747200000 , 5.4643833239669] , [ 1225425600000 , 5.3150786833374] , [ 1228021200000 , 5.3011272612576] , [ 1230699600000 , 4.1203601430809] , [ 1233378000000 , 4.0881783200525] , [ 1235797200000 , 4.1928665957189] , [ 1238472000000 , 7.0249415663205] , [ 1241064000000 , 7.006530880769] , [ 1243742400000 , 6.994835633224] , [ 1246334400000 , 6.1220222336254] , [ 1249012800000 , 6.1177436137653] , [ 1251691200000 , 6.1413396231981] , [ 1254283200000 , 4.8046006145874] , [ 1256961600000 , 4.6647600660544] , [ 1259557200000 , 4.544865006255] , [ 1262235600000 , 6.0488249316539] , [ 1264914000000 , 6.3188669540206] , [ 1267333200000 , 6.5873958262306] , [ 1270008000000 , 6.2281189839578] , [ 1272600000000 , 5.8948915746059] , [ 1275278400000 , 5.5967320482214] , [ 1277870400000 , 0.99784432084837] , [ 1280548800000 , 1.0950794175359] , [ 1283227200000 , 0.94479734407491] , [ 1285819200000 , 1.222093988688] , [ 1288497600000 , 1.335093106856] , [ 1291093200000 , 1.3302565104985] , [ 1293771600000 , 1.340824670897] , [ 1296450000000 , 0] , [ 1298869200000 , 0] , [ 1301544000000 , 0] , [ 1304136000000 , 0] , [ 1306814400000 , 0] , [ 1309406400000 , 0] , [ 1312084800000 , 0] , [ 1314763200000 , 0] , [ 1317355200000 , 4.4583692315] , [ 1320033600000 , 3.6493043348059] , [ 1322629200000 , 3.8610064091761] , [ 1325307600000 , 5.5144800685202] , [ 1327986000000 , 5.1750695220792] , [ 1330491600000 , 5.6710066952691] , [ 1333166400000 , 8.5658461590953] , [ 1335758400000 , 8.6135447714243] , [ 1338436800000 , 8.0231460925212]]
} ,
{
"key" : "Energy" ,
"values" : [ [ 1138683600000 , 1.544303464167] , [ 1141102800000 , 1.4387289432421] , [ 1143781200000 , 0] , [ 1146369600000 , 0] , [ 1149048000000 , 0] , [ 1151640000000 , 1.328626801128] , [ 1154318400000 , 1.2874050802627] , [ 1156996800000 , 1.0872743105593] , [ 1159588800000 , 0.96042562635813] , [ 1162270800000 , 0.93139372870616] , [ 1164862800000 , 0.94432167305385] , [ 1167541200000 , 1.277750166208] , [ 1170219600000 , 1.2204893886811] , [ 1172638800000 , 1.207489123122] , [ 1175313600000 , 1.2490651414113] , [ 1177905600000 , 1.2593129913052] , [ 1180584000000 , 1.373329808388] , [ 1183176000000 , 0] , [ 1185854400000 , 0] , [ 1188532800000 , 0] , [ 1191124800000 , 0] , [ 1193803200000 , 0] , [ 1196398800000 , 0] , [ 1199077200000 , 0] , [ 1201755600000 , 0] , [ 1204261200000 , 0] , [ 1206936000000 , 0] , [ 1209528000000 , 0] , [ 1212206400000 , 0] , [ 1214798400000 , 0] , [ 1217476800000 , 0] , [ 1220155200000 , 0] , [ 1222747200000 , 1.4516108933695] , [ 1225425600000 , 1.1856025268225] , [ 1228021200000 , 1.3430470355439] , [ 1230699600000 , 2.2752595354509] , [ 1233378000000 , 2.4031560010523] , [ 1235797200000 , 2.0822430731926] , [ 1238472000000 , 1.5640902826938] , [ 1241064000000 , 1.5812873972356] , [ 1243742400000 , 1.9462448548894] , [ 1246334400000 , 2.9464870223957] , [ 1249012800000 , 3.0744699383222] , [ 1251691200000 , 2.9422304628446] , [ 1254283200000 , 2.7503075599999] , [ 1256961600000 , 2.6506701800427] , [ 1259557200000 , 2.8005425319977] , [ 1262235600000 , 2.6816184971185] , [ 1264914000000 , 2.681206271327] , [ 1267333200000 , 2.8195488011259] , [ 1270008000000 , 0] , [ 1272600000000 , 0] , [ 1275278400000 , 0] , [ 1277870400000 , 1.0687057346382] , [ 1280548800000 , 1.2539400544134] , [ 1283227200000 , 1.1862969445955] , [ 1285819200000 , 0] , [ 1288497600000 , 0] , [ 1291093200000 , 0] , [ 1293771600000 , 0] , [ 1296450000000 , 1.941972859484] , [ 1298869200000 , 2.1142247697552] , [ 1301544000000 , 2.3788590206824] , [ 1304136000000 , 2.5337302877545] , [ 1306814400000 , 2.3163370395199] , [ 1309406400000 , 2.0645451843195] , [ 1312084800000 , 2.1004446672411] , [ 1314763200000 , 3.6301875804303] , [ 1317355200000 , 2.454204664652] , [ 1320033600000 , 2.196082370894] , [ 1322629200000 , 2.3358418255202] , [ 1325307600000 , 0] , [ 1327986000000 , 0] , [ 1330491600000 , 0] , [ 1333166400000 , 0.39001201038526] , [ 1335758400000 , 0.30945472725559] , [ 1338436800000 , 0.31062439305591]]
} ,
{
"key" : "Financials" ,
"values" : [ [ 1138683600000 , 13.356778764352] , [ 1141102800000 , 13.611196863271] , [ 1143781200000 , 6.895903006119] , [ 1146369600000 , 6.9939633271352] , [ 1149048000000 , 6.7241510257675] , [ 1151640000000 , 5.5611293669516] , [ 1154318400000 , 5.6086488714041] , [ 1156996800000 , 5.4962849907033] , [ 1159588800000 , 6.9193153169279] , [ 1162270800000 , 7.0016334389777] , [ 1164862800000 , 6.7865422443273] , [ 1167541200000 , 9.0006454225383] , [ 1170219600000 , 9.2233916171431] , [ 1172638800000 , 8.8929316009479] , [ 1175313600000 , 10.345937520404] , [ 1177905600000 , 10.075914677026] , [ 1180584000000 , 10.089006188111] , [ 1183176000000 , 10.598330295008] , [ 1185854400000 , 9.968954653301] , [ 1188532800000 , 9.7740580198146] , [ 1191124800000 , 10.558483060626] , [ 1193803200000 , 9.9314651823603] , [ 1196398800000 , 9.3997715873769] , [ 1199077200000 , 8.4086493387262] , [ 1201755600000 , 8.9698309085926] , [ 1204261200000 , 8.2778357995396] , [ 1206936000000 , 8.8585045600123] , [ 1209528000000 , 8.7013756413322] , [ 1212206400000 , 7.7933605469443] , [ 1214798400000 , 7.0236183483064] , [ 1217476800000 , 6.9873088186829] , [ 1220155200000 , 6.8031713070097] , [ 1222747200000 , 6.6869531315723] , [ 1225425600000 , 6.138256993963] , [ 1228021200000 , 5.6434994016354] , [ 1230699600000 , 5.495220262512] , [ 1233378000000 , 4.6885326869846] , [ 1235797200000 , 4.4524349883438] , [ 1238472000000 , 5.6766520778185] , [ 1241064000000 , 5.7675774480752] , [ 1243742400000 , 5.7882863168337] , [ 1246334400000 , 7.2666010034924] , [ 1249012800000 , 7.519182132226] , [ 1251691200000 , 7.849651451445] , [ 1254283200000 , 10.383992037985] , [ 1256961600000 , 9.0653691861818] , [ 1259557200000 , 9.6705248324159] , [ 1262235600000 , 10.856380561349] , [ 1264914000000 , 11.27452370892] , [ 1267333200000 , 11.754156529088] , [ 1270008000000 , 8.2870811422456] , [ 1272600000000 , 8.0210264360699] , [ 1275278400000 , 7.5375074474865] , [ 1277870400000 , 8.3419527338039] , [ 1280548800000 , 9.4197471818443] , [ 1283227200000 , 8.7321733185797] , [ 1285819200000 , 9.6627062648126] , [ 1288497600000 , 10.187962234549] , [ 1291093200000 , 9.8144201733476] , [ 1293771600000 , 10.275723361713] , [ 1296450000000 , 16.796066079353] , [ 1298869200000 , 17.543254984075] , [ 1301544000000 , 16.673660675084] , [ 1304136000000 , 17.963944353609] , [ 1306814400000 , 16.637740867211] , [ 1309406400000 , 15.84857094609] , [ 1312084800000 , 14.767303362182] , [ 1314763200000 , 24.778452182432] , [ 1317355200000 , 18.370353229999] , [ 1320033600000 , 15.2531374291] , [ 1322629200000 , 14.989600840649] , [ 1325307600000 , 16.052539160125] , [ 1327986000000 , 16.424390322793] , [ 1330491600000 , 17.884020741105] , [ 1333166400000 , 7.1424929577921] , [ 1335758400000 , 7.8076213051482] , [ 1338436800000 , 7.2462684949232]]
} ,
{
"key" : "Health Care" ,
"values" : [ [ 1138683600000 , 14.212410956029] , [ 1141102800000 , 13.973193618249] , [ 1143781200000 , 15.218233920665] , [ 1146369600000 , 14.38210972745] , [ 1149048000000 , 13.894310878491] , [ 1151640000000 , 15.593086090032] , [ 1154318400000 , 16.244839695188] , [ 1156996800000 , 16.017088850646] , [ 1159588800000 , 14.183951830055] , [ 1162270800000 , 14.148523245697] , [ 1164862800000 , 13.424326059972] , [ 1167541200000 , 12.974450435753] , [ 1170219600000 , 13.23247041802] , [ 1172638800000 , 13.318762655574] , [ 1175313600000 , 15.961407746104] , [ 1177905600000 , 16.287714639805] , [ 1180584000000 , 16.246590583889] , [ 1183176000000 , 17.564505594809] , [ 1185854400000 , 17.872725373165] , [ 1188532800000 , 18.018998508757] , [ 1191124800000 , 15.584518016603] , [ 1193803200000 , 15.480850647181] , [ 1196398800000 , 15.699120036984] , [ 1199077200000 , 19.184281817226] , [ 1201755600000 , 19.691226605207] , [ 1204261200000 , 18.982314051295] , [ 1206936000000 , 18.707820309008] , [ 1209528000000 , 17.459630929761] , [ 1212206400000 , 16.500616076782] , [ 1214798400000 , 18.086324003979] , [ 1217476800000 , 18.929464156258] , [ 1220155200000 , 18.233728682084] , [ 1222747200000 , 16.315776297325] , [ 1225425600000 , 14.63289219025] , [ 1228021200000 , 14.667835024478] , [ 1230699600000 , 13.946993947308] , [ 1233378000000 , 14.394304684397] , [ 1235797200000 , 13.724462792967] , [ 1238472000000 , 10.930879035806] , [ 1241064000000 , 9.8339915513708] , [ 1243742400000 , 10.053858541872] , [ 1246334400000 , 11.786998438287] , [ 1249012800000 , 11.780994901769] , [ 1251691200000 , 11.305889670276] , [ 1254283200000 , 10.918452290083] , [ 1256961600000 , 9.6811395055706] , [ 1259557200000 , 10.971529744038] , [ 1262235600000 , 13.330210480209] , [ 1264914000000 , 14.592637568961] , [ 1267333200000 , 14.605329141157] , [ 1270008000000 , 13.936853794037] , [ 1272600000000 , 12.189480759072] , [ 1275278400000 , 11.676151385046] , [ 1277870400000 , 13.058852800017] , [ 1280548800000 , 13.62891543203] , [ 1283227200000 , 13.811107569918] , [ 1285819200000 , 13.786494560787] , [ 1288497600000 , 14.04516285753] , [ 1291093200000 , 13.697412447288] , [ 1293771600000 , 13.677681376221] , [ 1296450000000 , 19.961511864531] , [ 1298869200000 , 21.049198298158] , [ 1301544000000 , 22.687631094008] , [ 1304136000000 , 25.469010617433] , [ 1306814400000 , 24.883799437121] , [ 1309406400000 , 24.203843814248] , [ 1312084800000 , 22.138760964038] , [ 1314763200000 , 16.034636966228] , [ 1317355200000 , 15.394958944556] , [ 1320033600000 , 12.625642461969] , [ 1322629200000 , 12.973735699739] , [ 1325307600000 , 15.786018336149] , [ 1327986000000 , 15.227368020134] , [ 1330491600000 , 15.899752650734] , [ 1333166400000 , 18.994731295388] , [ 1335758400000 , 18.450055817702] , [ 1338436800000 , 17.863719889669]]
} ,
{
"key" : "Industrials" ,
"values" : [ [ 1138683600000 , 7.1590087090398] , [ 1141102800000 , 7.1297210970108] , [ 1143781200000 , 5.5774588290586] , [ 1146369600000 , 5.4977254491156] , [ 1149048000000 , 5.5138153113634] , [ 1151640000000 , 4.3198084032122] , [ 1154318400000 , 3.9179295839125] , [ 1156996800000 , 3.8110093051479] , [ 1159588800000 , 5.5629020916939] , [ 1162270800000 , 5.7241673711336] , [ 1164862800000 , 5.4715049695004] , [ 1167541200000 , 4.9193763571618] , [ 1170219600000 , 5.136053947247] , [ 1172638800000 , 5.1327258759766] , [ 1175313600000 , 5.1888943925082] , [ 1177905600000 , 5.5191481293345] , [ 1180584000000 , 5.6093625614921] , [ 1183176000000 , 4.2706312987397] , [ 1185854400000 , 4.4453235132117] , [ 1188532800000 , 4.6228003109761] , [ 1191124800000 , 5.0645764756954] , [ 1193803200000 , 5.0723447230959] , [ 1196398800000 , 5.1457765818846] , [ 1199077200000 , 5.4067851597282] , [ 1201755600000 , 5.472241916816] , [ 1204261200000 , 5.3742740389688] , [ 1206936000000 , 6.251751933664] , [ 1209528000000 , 6.1406852153472] , [ 1212206400000 , 5.8164385627465] , [ 1214798400000 , 5.4255846656171] , [ 1217476800000 , 5.3738499417204] , [ 1220155200000 , 5.1815627753979] , [ 1222747200000 , 5.0305983235349] , [ 1225425600000 , 4.6823058607165] , [ 1228021200000 , 4.5941481589093] , [ 1230699600000 , 5.4669598474575] , [ 1233378000000 , 5.1249037357] , [ 1235797200000 , 4.3504421250742] , [ 1238472000000 , 4.6260881026002] , [ 1241064000000 , 5.0140402458946] , [ 1243742400000 , 4.7458462454774] , [ 1246334400000 , 6.0437019654564] , [ 1249012800000 , 6.4595216249754] , [ 1251691200000 , 6.6420468254155] , [ 1254283200000 , 5.8927271960913] , [ 1256961600000 , 5.4712108838003] , [ 1259557200000 , 6.1220254207747] , [ 1262235600000 , 5.5385935169255] , [ 1264914000000 , 5.7383377612639] , [ 1267333200000 , 6.1715976730415] , [ 1270008000000 , 4.0102262681174] , [ 1272600000000 , 3.769389679692] , [ 1275278400000 , 3.5301571031152] , [ 1277870400000 , 2.7660252652526] , [ 1280548800000 , 3.1409983385775] , [ 1283227200000 , 3.0528024863055] , [ 1285819200000 , 4.3126123157971] , [ 1288497600000 , 4.594654041683] , [ 1291093200000 , 4.5424126126793] , [ 1293771600000 , 4.7790043987302] , [ 1296450000000 , 7.4969154058289] , [ 1298869200000 , 7.9424751557821] , [ 1301544000000 , 7.1560736250547] , [ 1304136000000 , 7.9478117337855] , [ 1306814400000 , 7.4109214848895] , [ 1309406400000 , 7.5966457641101] , [ 1312084800000 , 7.165754444071] , [ 1314763200000 , 5.4816702524302] , [ 1317355200000 , 4.9893656089584] , [ 1320033600000 , 4.498385105327] , [ 1322629200000 , 4.6776090358151] , [ 1325307600000 , 8.1350814368063] , [ 1327986000000 , 8.0732769990652] , [ 1330491600000 , 8.5602340387277] , [ 1333166400000 , 5.1293714074325] , [ 1335758400000 , 5.2586794619016] , [ 1338436800000 , 5.1100853569977]]
} ,
{
"key" : "Information Technology" ,
"values" : [ [ 1138683600000 , 13.242301508051] , [ 1141102800000 , 12.863536342042] , [ 1143781200000 , 21.034044171629] , [ 1146369600000 , 21.419084618803] , [ 1149048000000 , 21.142678863691] , [ 1151640000000 , 26.568489677529] , [ 1154318400000 , 24.839144939905] , [ 1156996800000 , 25.456187462167] , [ 1159588800000 , 26.350164502826] , [ 1162270800000 , 26.47833320519] , [ 1164862800000 , 26.425979547847] , [ 1167541200000 , 28.191461582256] , [ 1170219600000 , 28.930307448808] , [ 1172638800000 , 29.521413891117] , [ 1175313600000 , 28.188285966466] , [ 1177905600000 , 27.704619625832] , [ 1180584000000 , 27.490862424829] , [ 1183176000000 , 28.770679721286] , [ 1185854400000 , 29.060480671449] , [ 1188532800000 , 28.240998844973] , [ 1191124800000 , 33.004893194127] , [ 1193803200000 , 34.075180359928] , [ 1196398800000 , 32.548560664833] , [ 1199077200000 , 30.629727432728] , [ 1201755600000 , 28.642858788159] , [ 1204261200000 , 27.973575227842] , [ 1206936000000 , 27.393351882726] , [ 1209528000000 , 28.476095288523] , [ 1212206400000 , 29.29667866426] , [ 1214798400000 , 29.222333802896] , [ 1217476800000 , 28.092966093843] , [ 1220155200000 , 28.107159262922] , [ 1222747200000 , 25.482974832098] , [ 1225425600000 , 21.208115993834] , [ 1228021200000 , 20.295043095268] , [ 1230699600000 , 15.925754618401] , [ 1233378000000 , 17.162864628346] , [ 1235797200000 , 17.084345773174] , [ 1238472000000 , 22.246007102281] , [ 1241064000000 , 24.530543998509] , [ 1243742400000 , 25.084184918242] , [ 1246334400000 , 16.606166527358] , [ 1249012800000 , 17.239620011628] , [ 1251691200000 , 17.336739127379] , [ 1254283200000 , 25.478492475753] , [ 1256961600000 , 23.017152085245] , [ 1259557200000 , 25.617745423683] , [ 1262235600000 , 24.061133998642] , [ 1264914000000 , 23.223933318644] , [ 1267333200000 , 24.425887263937] , [ 1270008000000 , 35.501471156693] , [ 1272600000000 , 33.775013878676] , [ 1275278400000 , 30.417993630285] , [ 1277870400000 , 30.023598978467] , [ 1280548800000 , 33.327519522436] , [ 1283227200000 , 31.963388450371] , [ 1285819200000 , 30.498967232092] , [ 1288497600000 , 32.403696817912] , [ 1291093200000 , 31.47736071922] , [ 1293771600000 , 31.53259666241] , [ 1296450000000 , 41.760282761548] , [ 1298869200000 , 45.605771243237] , [ 1301544000000 , 39.986557966215] , [ 1304136000000 , 43.846330510051] , [ 1306814400000 , 39.857316881857] , [ 1309406400000 , 37.675127768208] , [ 1312084800000 , 35.775077970313] , [ 1314763200000 , 48.631009702577] , [ 1317355200000 , 42.830831754505] , [ 1320033600000 , 35.611502589362] , [ 1322629200000 , 35.320136981738] , [ 1325307600000 , 31.564136901516] , [ 1327986000000 , 32.074407502433] , [ 1330491600000 , 35.053013769976] , [ 1333166400000 , 26.434568573937] , [ 1335758400000 , 25.305617871002] , [ 1338436800000 , 24.520919418236]]
} ,
{
"key" : "Materials" ,
"values" : [ [ 1138683600000 , 5.5806167415681] , [ 1141102800000 , 5.4539047069985] , [ 1143781200000 , 7.6728842432362] , [ 1146369600000 , 7.719946716654] , [ 1149048000000 , 8.0144619912942] , [ 1151640000000 , 7.942223133434] , [ 1154318400000 , 8.3998279827444] , [ 1156996800000 , 8.532324572605] , [ 1159588800000 , 4.7324285199763] , [ 1162270800000 , 4.7402397487697] , [ 1164862800000 , 4.9042069355168] , [ 1167541200000 , 5.9583963430882] , [ 1170219600000 , 6.3693899239171] , [ 1172638800000 , 6.261153903813] , [ 1175313600000 , 5.3443942184584] , [ 1177905600000 , 5.4932111235361] , [ 1180584000000 , 5.5747393101109] , [ 1183176000000 , 5.3833633060013] , [ 1185854400000 , 5.5125898831832] , [ 1188532800000 , 5.8116112661327] , [ 1191124800000 , 4.3962296939996] , [ 1193803200000 , 4.6967663605521] , [ 1196398800000 , 4.7963004350914] , [ 1199077200000 , 4.1817985183351] , [ 1201755600000 , 4.3797643870182] , [ 1204261200000 , 4.6966642197965] , [ 1206936000000 , 4.3609995132565] , [ 1209528000000 , 4.4736290996496] , [ 1212206400000 , 4.3749762738128] , [ 1214798400000 , 3.3274661194507] , [ 1217476800000 , 3.0316184691337] , [ 1220155200000 , 2.5718140204728] , [ 1222747200000 , 2.7034994044603] , [ 1225425600000 , 2.2033786591364] , [ 1228021200000 , 1.9850621240805] , [ 1230699600000 , 0] , [ 1233378000000 , 0] , [ 1235797200000 , 0] , [ 1238472000000 , 0] , [ 1241064000000 , 0] , [ 1243742400000 , 0] , [ 1246334400000 , 0] , [ 1249012800000 , 0] , [ 1251691200000 , 0] , [ 1254283200000 , 0.44495950017788] , [ 1256961600000 , 0.33945469262483] , [ 1259557200000 , 0.38348269455195] , [ 1262235600000 , 0] , [ 1264914000000 , 0] , [ 1267333200000 , 0] , [ 1270008000000 , 0] , [ 1272600000000 , 0] , [ 1275278400000 , 0] , [ 1277870400000 , 0] , [ 1280548800000 , 0] , [ 1283227200000 , 0] , [ 1285819200000 , 0] , [ 1288497600000 , 0] , [ 1291093200000 , 0] , [ 1293771600000 , 0] , [ 1296450000000 , 0.52216435716176] , [ 1298869200000 , 0.59275786698454] , [ 1301544000000 , 0] , [ 1304136000000 , 0] , [ 1306814400000 , 0] , [ 1309406400000 , 0] , [ 1312084800000 , 0] , [ 1314763200000 , 0] , [ 1317355200000 , 0] , [ 1320033600000 , 0] , [ 1322629200000 , 0] , [ 1325307600000 , 0] , [ 1327986000000 , 0] , [ 1330491600000 , 0] , [ 1333166400000 , 0] , [ 1335758400000 , 0] , [ 1338436800000 , 0]]
} ,
{
"key" : "Telecommunication Services" ,
"values" : [ [ 1138683600000 , 3.7056975170243] , [ 1141102800000 , 3.7561118692318] , [ 1143781200000 , 2.861913700854] , [ 1146369600000 , 2.9933744103381] , [ 1149048000000 , 2.7127537218463] , [ 1151640000000 , 3.1195497076283] , [ 1154318400000 , 3.4066964004508] , [ 1156996800000 , 3.3754571113569] , [ 1159588800000 , 2.2965579982924] , [ 1162270800000 , 2.4486818633018] , [ 1164862800000 , 2.4002308848517] , [ 1167541200000 , 1.9649579750349] , [ 1170219600000 , 1.9385263638056] , [ 1172638800000 , 1.9128975336387] , [ 1175313600000 , 2.3412869836298] , [ 1177905600000 , 2.4337870351445] , [ 1180584000000 , 2.62179703171] , [ 1183176000000 , 3.2642864957929] , [ 1185854400000 , 3.3200396223709] , [ 1188532800000 , 3.3934212707572] , [ 1191124800000 , 4.2822327088179] , [ 1193803200000 , 4.1474964228541] , [ 1196398800000 , 4.1477082879801] , [ 1199077200000 , 5.2947122916128] , [ 1201755600000 , 5.2919843508028] , [ 1204261200000 , 5.1989783050309] , [ 1206936000000 , 3.5603057673513] , [ 1209528000000 , 3.3009087690692] , [ 1212206400000 , 3.1784852603792] , [ 1214798400000 , 4.5889503538868] , [ 1217476800000 , 4.401779617494] , [ 1220155200000 , 4.2208301828278] , [ 1222747200000 , 3.89396671475] , [ 1225425600000 , 3.0423832241354] , [ 1228021200000 , 3.135520611578] , [ 1230699600000 , 1.9631418164089] , [ 1233378000000 , 1.8963543874958] , [ 1235797200000 , 1.8266636017025] , [ 1238472000000 , 0.93136635895188] , [ 1241064000000 , 0.92737801918888] , [ 1243742400000 , 0.97591889805002] , [ 1246334400000 , 2.6841193805515] , [ 1249012800000 , 2.5664341140531] , [ 1251691200000 , 2.3887523699873] , [ 1254283200000 , 1.1737801663681] , [ 1256961600000 , 1.0953582317281] , [ 1259557200000 , 1.2495674976653] , [ 1262235600000 , 0.36607452464754] , [ 1264914000000 , 0.3548719047291] , [ 1267333200000 , 0.36769242398939] , [ 1270008000000 , 0] , [ 1272600000000 , 0] , [ 1275278400000 , 0] , [ 1277870400000 , 0] , [ 1280548800000 , 0] , [ 1283227200000 , 0] , [ 1285819200000 , 0.85450741275337] , [ 1288497600000 , 0.91360317921637] , [ 1291093200000 , 0.89647678692269] , [ 1293771600000 , 0.87800687192639] , [ 1296450000000 , 0] , [ 1298869200000 , 0] , [ 1301544000000 , 0.43668720882994] , [ 1304136000000 , 0.4756523602692] , [ 1306814400000 , 0.46947368328469] , [ 1309406400000 , 0.45138896152316] , [ 1312084800000 , 0.43828726648117] , [ 1314763200000 , 2.0820861395316] , [ 1317355200000 , 0.9364411075395] , [ 1320033600000 , 0.60583907839773] , [ 1322629200000 , 0.61096950747437] , [ 1325307600000 , 0] , [ 1327986000000 , 0] , [ 1330491600000 , 0] , [ 1333166400000 , 0] , [ 1335758400000 , 0] , [ 1338436800000 , 0]]
} ,
{
"key" : "Utilities" ,
"values" : [ [ 1138683600000 , 0] , [ 1141102800000 , 0] , [ 1143781200000 , 0] , [ 1146369600000 , 0] , [ 1149048000000 , 0] , [ 1151640000000 , 0] , [ 1154318400000 , 0] , [ 1156996800000 , 0] , [ 1159588800000 , 0] , [ 1162270800000 , 0] , [ 1164862800000 , 0] , [ 1167541200000 , 0] , [ 1170219600000 , 0] , [ 1172638800000 , 0] , [ 1175313600000 , 0] , [ 1177905600000 , 0] , [ 1180584000000 , 0] , [ 1183176000000 , 0] , [ 1185854400000 , 0] , [ 1188532800000 , 0] , [ 1191124800000 , 0] , [ 1193803200000 , 0] , [ 1196398800000 , 0] , [ 1199077200000 , 0] , [ 1201755600000 , 0] , [ 1204261200000 , 0] , [ 1206936000000 , 0] , [ 1209528000000 , 0] , [ 1212206400000 , 0] , [ 1214798400000 , 0] , [ 1217476800000 , 0] , [ 1220155200000 , 0] , [ 1222747200000 , 0] , [ 1225425600000 , 0] , [ 1228021200000 , 0] , [ 1230699600000 , 0] , [ 1233378000000 , 0] , [ 1235797200000 , 0] , [ 1238472000000 , 0] , [ 1241064000000 , 0] , [ 1243742400000 , 0] , [ 1246334400000 , 0] , [ 1249012800000 , 0] , [ 1251691200000 , 0] , [ 1254283200000 , 0] , [ 1256961600000 , 0] , [ 1259557200000 , 0] , [ 1262235600000 , 0] , [ 1264914000000 , 0] , [ 1267333200000 , 0] , [ 1270008000000 , 0] , [ 1272600000000 , 0] , [ 1275278400000 , 0] , [ 1277870400000 , 0] , [ 1280548800000 , 0] , [ 1283227200000 , 0] , [ 1285819200000 , 0] , [ 1288497600000 , 0] , [ 1291093200000 , 0] , [ 1293771600000 , 0] , [ 1296450000000 , 0] , [ 1298869200000 , 0] , [ 1301544000000 , 0] , [ 1304136000000 , 0] , [ 1306814400000 , 0] , [ 1309406400000 , 0] , [ 1312084800000 , 0] , [ 1314763200000 , 0] , [ 1317355200000 , 0] , [ 1320033600000 , 0] , [ 1322629200000 , 0] , [ 1325307600000 , 0] , [ 1327986000000 , 0] , [ 1330491600000 , 0] , [ 1333166400000 , 0] , [ 1335758400000 , 0] , [ 1338436800000 , 0]]
}
];
// for testing single data point
var histcatexplong_singledatapoint = [
{
"key" : "Consumer Discretionary" ,
"values" : [ [ 1138683600000 , 27.38478809681]]
} ,
{
"key" : "Consumer Staples" ,
"values" : [ [ 1138683600000 , 7.2800122043237]]
} ,
{
"key" : "Energy" ,
"values" : [ [ 1138683600000 , 1.544303464167]]
} ,
{
"key" : "Financials" ,
"values" : [ [ 1138683600000 , 13.356778764352]]
} ,
{
"key" : "Health Care" ,
"values" : [ [ 1138683600000 , 14.212410956029]]
} ,
{
"key" : "Industrials" ,
"values" : [ [ 1138683600000 , 7.1590087090398]]
} ,
{
"key" : "Information Technology" ,
"values" : [ [ 1138683600000 , 13.242301508051]]
} ,
{
"key" : "Materials" ,
"values" : [ [ 1138683600000 , 5.5806167415681]]
} ,
{
"key" : "Telecommunication Services" ,
"values" : [ [ 1138683600000 , 3.7056975170243]]
} ,
{
"key" : "Utilities" ,
"values" : [ [ 1138683600000 , 0]]
}
];
// for testing two data point s
var histcatexplong_twodatapoint = [
{
"key" : "Consumer Discretionary" ,
"values" : [ [ 1138683600000 , 27.38478809681], [ 1141102800000 , 29.4] ]
} ,
{
"key" : "Consumer Staples" ,
"values" : [ [ 1138683600000 , 7.2800122043237], [ 1141102800000 , 6.7]]
} ,
{
"key" : "Energy" ,
"values" : [ [ 1138683600000 , 1.544303464167], [ 1141102800000 , 2.4]]
} ,
{
"key" : "Financials" ,
"values" : [ [ 1138683600000 , 13.356778764352], [ 1141102800000 , 19.2]]
} ,
{
"key" : "Health Care" ,
"values" : [ [ 1138683600000 , 14.212410956029], [ 1141102800000 , 15.4]]
} ,
{
"key" : "Industrials" ,
"values" : [ [ 1138683600000 , 7.1590087090398], [ 1141102800000 , 10.3]]
} ,
{
"key" : "Information Technology" ,
"values" : [ [ 1138683600000 , 13.242301508051], [ 1141102800000 , 14.3]]
} ,
{
"key" : "Materials" ,
"values" : [ [ 1138683600000 , 5.5806167415681], [ 1141102800000 , 3.2]]
} ,
{
"key" : "Telecommunication Services" ,
"values" : [ [ 1138683600000 , 3.7056975170243], [ 1141102800000 , 1.3]]
} ,
{
"key" : "Utilities" ,
"values" : [ [ 1138683600000 , 0], [ 1141102800000 , 2]]
}
];
var histcatexplong_withholes = [
{
"key" : "Consumer Discretionary" ,
"values" : [ [ 1138683600000 , 27.38478809681] , [ 1141102800000 , 27.371377218208] , [ 1143781200000 , 26.309915460827] , [ 1146369600000 , 26.425199957521] , [ 1149048000000 , 26.823411519395] , [ 1151640000000 , 23.850443591584] , [ 1154318400000 , 23.158355444054] , [ 1156996800000 , 22.998689393694] , [ 1159588800000 , 27.977128511299] , [ 1162270800000 , 29.073672469721] , [ 1164862800000 , 28.587640408904] , [ 1167541200000 , 22.788453687638] , [ 1170219600000 , 22.429199073597] , [ 1172638800000 , 22.324103271051] , [ 1175313600000 , 17.558388444186] , [ 1177905600000 , 16.769518096208] , [ 1180584000000 , 16.214738201302] , [ 1183176000000 , 18.729632971228] , [ 1185854400000 , 18.814523318848] , [ 1188532800000 , 19.789986451358] , [ 1191124800000 , 17.070049054933] , [ 1193803200000 , 16.121349575715] , [ 1196398800000 , 15.141659430091] , [ 1199077200000 , 0] , [ 1201755600000 , 0] , [ 1204261200000 , 0] , [ 1206936000000 , 19.231263773952] , [ 1209528000000 , 18.446256391094] , [ 1212206400000 , 17.822632399764] , [ 1214798400000 , 15.539366475979] , [ 1217476800000 , 15.255131790216] , [ 1220155200000 , 15.660963922593] , [ 1222747200000 , 13.254482273697] , [ 1225425600000 , 11.920796202299] , [ 1228021200000 , 12.122809090925] , [ 1230699600000 , 15.691026271393] , [ 1233378000000 , 14.720881635107] , [ 1235797200000 , 15.387939360044] , [ 1238472000000 , 13.765436672229] , [ 1241064000000 , 14.6314458648] , [ 1243742400000 , 14.292446536221] , [ 1246334400000 , 16.170071367016] , [ 1249012800000 , 15.948135554337] , [ 1251691200000 , 16.612872685134] , [ 1254283200000 , 18.778338719091] , [ 1256961600000 , 16.75602606542] , [ 1259557200000 , 19.385804443147] , [ 1262235600000 , 22.950590240168] , [ 1264914000000 , 23.61159018141] , [ 1267333200000 , 25.708586989581] , [ 1270008000000 , 26.883915999885] , [ 1272600000000 , 25.893486687065] , [ 1275278400000 , 24.678914263176] , [ 1277870400000 , 25.937275793023] , [ 1280548800000 , 0] , [ 1283227200000 , 0] , [ 1285819200000 , 29.057235285673] , [ 1288497600000 , 28.549434189386] , [ 1291093200000 , 28.506352379723] , [ 1293771600000 , 29.449241421597] , [ 1296450000000 , 25.796838168807] , [ 1298869200000 , 28.740145449189] , [ 1301544000000 , 22.091744141872] , [ 1304136000000 , 25.079662545409] , [ 1306814400000 , 23.674906973064] , [ 1309406400000 , 23.41800274293] , [ 1312084800000 , 23.243644138871] , [ 1314763200000 , 31.591854066817] , [ 1317355200000 , 31.497112374114] , [ 1320033600000 , 26.672380820431] , [ 1322629200000 , 27.297080015495] , [ 1325307600000 , 20.174315530051] , [ 1327986000000 , 19.631084213899] , [ 1330491600000 , 20.366462219462] , [ 1333166400000 , 17.429019937289] , [ 1335758400000 , 16.75543633539] , [ 1338436800000 , 16.182906906042]]
} ,
{
"key" : "Consumer Staples" ,
"values" : [ [ 1138683600000 , 7.2800122043237] , [ 1141102800000 , 7.1187787503354] , [ 1143781200000 , 8.351887016482] , [ 1146369600000 , 8.4156698763993] , [ 1149048000000 , 8.1673298604231] , [ 1151640000000 , 5.5132447126042] , [ 1154318400000 , 6.1152537710599] , [ 1156996800000 , 6.076765091942] , [ 1159588800000 , 4.6304473798646] , [ 1162270800000 , 4.6301068469402] , [ 1164862800000 , 4.3466656309389] , [ 1167541200000 , 6.830104897003] , [ 1170219600000 , 7.241633040029] , [ 1172638800000 , 7.1432372054153] , [ 1175313600000 , 10.608942063374] , [ 1177905600000 , 10.914964549494] , [ 1180584000000 , 10.933223880565] , [ 1183176000000 , 8.3457524851265] , [ 1185854400000 , 8.1078413081882] , [ 1188532800000 , 8.2697185922474] , [ 1191124800000 , 8.4742436475968] , [ 1193803200000 , 8.4994601179319] , [ 1196398800000 , 8.7387319683243] , [ 1199077200000 , 6.8829183612895] , [ 1201755600000 , 6.984133637885] , [ 1204261200000 , 7.0860136043287] , [ 1206936000000 , 4.3961787956053] , [ 1209528000000 , 3.8699674365231] , [ 1212206400000 , 3.6928925238305] , [ 1214798400000 , 6.7571718894253] , [ 1217476800000 , 6.4367313362344] , [ 1220155200000 , 6.4048441521454] , [ 1222747200000 , 5.4643833239669] , [ 1225425600000 , 5.3150786833374] , [ 1228021200000 , 5.3011272612576] , [ 1230699600000 , 4.1203601430809] , [ 1233378000000 , 4.0881783200525] , [ 1235797200000 , 4.1928665957189] , [ 1238472000000 , 7.0249415663205] , [ 1241064000000 , 7.006530880769] , [ 1243742400000 , 6.994835633224] , [ 1246334400000 , 6.1220222336254] , [ 1249012800000 , 6.1177436137653] , [ 1251691200000 , 6.1413396231981] , [ 1254283200000 , 4.8046006145874] , [ 1256961600000 , 4.6647600660544] , [ 1259557200000 , 4.544865006255] , [ 1262235600000 , 6.0488249316539] , [ 1264914000000 , 6.3188669540206] , [ 1267333200000 , 6.5873958262306] , [ 1270008000000 , 6.2281189839578] , [ 1272600000000 , 5.8948915746059] , [ 1275278400000 , 5.5967320482214] , [ 1277870400000 , 0.99784432084837] , [ 1280548800000 , 1.0950794175359] , [ 1283227200000 , 0.94479734407491] , [ 1285819200000 , 1.222093988688] , [ 1288497600000 , 1.335093106856] , [ 1291093200000 , 1.3302565104985] , [ 1293771600000 , 1.340824670897] , [ 1296450000000 , 0] , [ 1298869200000 , 0] , [ 1301544000000 , 0] , [ 1304136000000 , 0] , [ 1306814400000 , 0] , [ 1309406400000 , 0] , [ 1312084800000 , 0] , [ 1314763200000 , 0] , [ 1317355200000 , 4.4583692315] , [ 1320033600000 , 3.6493043348059] , [ 1322629200000 , 3.8610064091761] , [ 1325307600000 , 5.5144800685202] , [ 1327986000000 , 5.1750695220792] , [ 1330491600000 , 5.6710066952691] , [ 1333166400000 , 8.5658461590953] , [ 1335758400000 , 8.6135447714243] , [ 1338436800000 , 8.0231460925212]]
}];
var histcatexpshort = [
{
"key" : "Consumer Staples" ,
"values" : [ [ 1138683600000 , 0] , [ 1141102800000 , 0] , [ 1143781200000 , 0] , [ 1146369600000 , 0] , [ 1149048000000 , 0] , [ 1151640000000 , 0] , [ 1154318400000 , 0] , [ 1156996800000 , 0] , [ 1159588800000 , 0] , [ 1162270800000 , 0] , [ 1164862800000 , 0] , [ 1167541200000 , -0.24102139376003] , [ 1170219600000 , -0.69960584365035] , [ 1172638800000 , -0.67365051426185] , [ 1175313600000 , 0] , [ 1177905600000 , 0] , [ 1180584000000 , 0] , [ 1183176000000 , -0.31429312464988] , [ 1185854400000 , -0.90018700397153] , [ 1188532800000 , -0.96926214328714] , [ 1191124800000 , -1.1343386468131] , [ 1193803200000 , -1.1335426595455] , [ 1196398800000 , -1.2327663032424] , [ 1199077200000 , -0.41027135492155] , [ 1201755600000 , -0.41779167524802] , [ 1204261200000 , -0.38133883625885] , [ 1206936000000 , 0] , [ 1209528000000 , -0.32550520320253] , [ 1212206400000 , -0.33185144615505] , [ 1214798400000 , -0.68609668877894] , [ 1217476800000 , -0.70001207744308] , [ 1220155200000 , -0.68378680840919] , [ 1222747200000 , -0.40908783182034] , [ 1225425600000 , -0.39074266525646] , [ 1228021200000 , -0.40358490474562] , [ 1230699600000 , -0.85752207262267] , [ 1233378000000 , -0.74395750438805] , [ 1235797200000 , -0.70718832429489] , [ 1238472000000 , -0.76244465406965] , [ 1241064000000 , -0.67618572591984] , [ 1243742400000 , -0.67649596761402] , [ 1246334400000 , -0.94618002703247] , [ 1249012800000 , -0.95408485581014] , [ 1251691200000 , -0.96272139504276] , [ 1254283200000 , 0] , [ 1256961600000 , 0] , [ 1259557200000 , 0] , [ 1262235600000 , 0] , [ 1264914000000 , 0] , [ 1267333200000 , 0] , [ 1270008000000 , -0.25516420149471] , [ 1272600000000 , -0.24106264576017] , [ 1275278400000 , -0.22802547751448] , [ 1277870400000 , -0.62187524046697] , [ 1280548800000 , -0.72155608677106] , [ 1283227200000 , -0.70221659944774] , [ 1285819200000 , -1.1117002584543] , [ 1288497600000 , -1.190911001336] , [ 1291093200000 , -1.1781082003972] , [ 1293771600000 , -1.2125860264875] , [ 1296450000000 , -1.7748010365657] , [ 1298869200000 , -1.8919594178596] , [ 1301544000000 , -1.7077946421533] , [ 1304136000000 , -2.024238803094] , [ 1306814400000 , -1.9769844081819] , [ 1309406400000 , -2.0730275464065] , [ 1312084800000 , -1.9690128240888] , [ 1314763200000 , -5.5557852269348] , [ 1317355200000 , -7.2527933190641] , [ 1320033600000 , -5.7367677053109] , [ 1322629200000 , -6.0409316206662] , [ 1325307600000 , -4.6511525539195] , [ 1327986000000 , -4.526116059083] , [ 1330491600000 , -4.846292325197] , [ 1333166400000 , -2.2663198779425] , [ 1335758400000 , -2.4172072568564] , [ 1338436800000 , -2.3204729601189]]
} ,
{
"key" : "Consumer Discretionary" ,
"values" : [ [ 1138683600000 , -0.62238434102863] , [ 1141102800000 , -0.61484565039024] , [ 1143781200000 , -1.0769367918668] , [ 1146369600000 , -1.2221156604129] , [ 1149048000000 , -1.2434858263377] , [ 1151640000000 , -0.58606435489597] , [ 1154318400000 , -0.61478911495141] , [ 1156996800000 , -0.61429362688591] , [ 1159588800000 , -1.1168614112788] , [ 1162270800000 , -1.1510268716612] , [ 1164862800000 , -1.1104724164222] , [ 1167541200000 , -1.2298338563471] , [ 1170219600000 , -1.5053664389104] , [ 1172638800000 , -1.5535266372193] , [ 1175313600000 , -3.1690472535854] , [ 1177905600000 , -3.1273013967041] , [ 1180584000000 , -3.155466271777] , [ 1183176000000 , -3.7158562579437] , [ 1185854400000 , -3.8244546635586] , [ 1188532800000 , -3.5524464859972] , [ 1191124800000 , -3.0472339109128] , [ 1193803200000 , -3.064978140815] , [ 1196398800000 , -3.0818130124986] , [ 1199077200000 , -2.9806791138312] , [ 1201755600000 , -3.7360958775824] , [ 1204261200000 , -3.4687841733263] , [ 1206936000000 , -3.3702018615806] , [ 1209528000000 , -3.1982756208679] , [ 1212206400000 , -3.0489433155104] , [ 1214798400000 , -3.7008275605963] , [ 1217476800000 , -3.8980507260892] , [ 1220155200000 , -3.7680083260241] , [ 1222747200000 , -3.2061890012391] , [ 1225425600000 , -2.6727551440484] , [ 1228021200000 , -2.4469327462935] , [ 1230699600000 , -3.0192419668784] , [ 1233378000000 , -2.892958553476] , [ 1235797200000 , -3.1153570053479] , [ 1238472000000 , -2.9927580570711] , [ 1241064000000 , -3.5061796706294] , [ 1243742400000 , -3.2944159516725] , [ 1246334400000 , -3.4154213240617] , [ 1249012800000 , -3.6492125438171] , [ 1251691200000 , -3.6674164998394] , [ 1254283200000 , -4.6271484977727] , [ 1256961600000 , -4.2433407292676] , [ 1259557200000 , -4.4742625247274] , [ 1262235600000 , -5.2078214612359] , [ 1264914000000 , -5.2209579214469] , [ 1267333200000 , -5.4596395756061] , [ 1270008000000 , -5.6906459276584] , [ 1272600000000 , -6.4981737808665] , [ 1275278400000 , -6.2563044048578] , [ 1277870400000 , -6.175479487959] , [ 1280548800000 , -6.6641002427295] , [ 1283227200000 , -6.3648667745556] , [ 1285819200000 , -5.0270168607884] , [ 1288497600000 , -5.1186072976233] , [ 1291093200000 , -5.1127601587872] , [ 1293771600000 , -5.3015262972641] , [ 1296450000000 , -4.4295728671596] , [ 1298869200000 , -4.5488139745696] , [ 1301544000000 , -2.9021260315957] , [ 1304136000000 , -3.1482096241139] , [ 1306814400000 , -2.8648831814763] , [ 1309406400000 , -2.8149423433441] , [ 1312084800000 , -2.6350669145713] , [ 1314763200000 , -5.9871754759038] , [ 1317355200000 , -8.6127555816399] , [ 1320033600000 , -7.0712887348892] , [ 1322629200000 , -7.3930257999857] , [ 1325307600000 , -6.5183071556304] , [ 1327986000000 , -7.4388913793503] , [ 1330491600000 , -8.2134465182649] , [ 1333166400000 , -7.7836036697105] , [ 1335758400000 , -8.0955053683936] , [ 1338436800000 , -8.0981845818893]]
} ,
{
"key" : "Energy" ,
"values" : [ [ 1138683600000 , -0.95707527558303] , [ 1141102800000 , -0.78324346694487] , [ 1143781200000 , -1.2905241058019] , [ 1146369600000 , -1.3880880486779] , [ 1149048000000 , -1.3337247185993] , [ 1151640000000 , -1.0342112071924] , [ 1154318400000 , -1.1264764100183] , [ 1156996800000 , -1.0001002640852] , [ 1159588800000 , -0.85341153093953] , [ 1162270800000 , -0.88452017844596] , [ 1164862800000 , -0.84305725300642] , [ 1167541200000 , -1.0874455682301] , [ 1170219600000 , -1.1714969043168] , [ 1172638800000 , -1.1445856467934] , [ 1175313600000 , -1.1928513334073] , [ 1177905600000 , -1.2365691634265] , [ 1180584000000 , -1.2690940962478] , [ 1183176000000 , -1.662233774695] , [ 1185854400000 , -1.745760538781] , [ 1188532800000 , -1.5209200931271] , [ 1191124800000 , -1.7874791820886] , [ 1193803200000 , -1.7755668105117] , [ 1196398800000 , -1.5456069064618] , [ 1199077200000 , -1.7077541586335] , [ 1201755600000 , -1.6462081650757] , [ 1204261200000 , -1.8624735339628] , [ 1206936000000 , -0.71073453533048] , [ 1209528000000 , -0.75380709640219] , [ 1212206400000 , -0.71020554911716] , [ 1214798400000 , -1.2077850914504] , [ 1217476800000 , -1.0505576787644] , [ 1220155200000 , -0.97804595164878] , [ 1222747200000 , -0.34591294663671] , [ 1225425600000 , -0.19958331514025] , [ 1228021200000 , -0.17599782216296] , [ 1230699600000 , -0.49577714121027] , [ 1233378000000 , -0.51644059173978] , [ 1235797200000 , -0.48576859637083] , [ 1238472000000 , -0.75596531126452] , [ 1241064000000 , -0.72073358315801] , [ 1243742400000 , -0.82125996732294] , [ 1246334400000 , -1.4933216860121] , [ 1249012800000 , -1.5003760525933] , [ 1251691200000 , -1.4744921420596] , [ 1254283200000 , -1.8197844060652] , [ 1256961600000 , -1.6558574419626] , [ 1259557200000 , -1.7256149254159] , [ 1262235600000 , -2.7667194124217] , [ 1264914000000 , -2.9113351806903] , [ 1267333200000 , -3.0172806042796] , [ 1270008000000 , -2.8607175559701] , [ 1272600000000 , -2.629226972169] , [ 1275278400000 , -2.1855196883832] , [ 1277870400000 , 0] , [ 1280548800000 , 0] , [ 1283227200000 , 0] , [ 1285819200000 , -1.3788733828844] , [ 1288497600000 , -1.4136792139765] , [ 1291093200000 , -1.5176522942901] , [ 1293771600000 , -1.5776651933208] , [ 1296450000000 , -1.7171675182182] , [ 1298869200000 , -1.8121885250566] , [ 1301544000000 , -1.2221934283206] , [ 1304136000000 , -1.2910715239439] , [ 1306814400000 , -1.1492301612576] , [ 1309406400000 , -1.0613891302841] , [ 1312084800000 , -0.99605193205308] , [ 1314763200000 , -1.7324212072278] , [ 1317355200000 , -1.5226856867477] , [ 1320033600000 , -1.3159138896549] , [ 1322629200000 , -1.3925952659299] , [ 1325307600000 , -1.59624913621] , [ 1327986000000 , -1.5235879880296] , [ 1330491600000 , -1.7315573519279] , [ 1333166400000 , -0.86883431220926] , [ 1335758400000 , -0.90144871282829] , [ 1338436800000 , -0.7010492182517]]
} ,
{
"key" : "Financials" ,
"values" : [ [ 1138683600000 , -0.56797103580254] , [ 1141102800000 , -0.57324319174933] , [ 1143781200000 , -1.1014818753272] , [ 1146369600000 , -1.1480256918118] , [ 1149048000000 , -1.0709335336775] , [ 1151640000000 , -0.84876993929658] , [ 1154318400000 , -0.88122638919979] , [ 1156996800000 , -0.86421146074279] , [ 1159588800000 , -0.95093689377974] , [ 1162270800000 , -0.96646862382248] , [ 1164862800000 , -0.96726919442167] , [ 1167541200000 , -0.99874655234936] , [ 1170219600000 , -1.0004843898938] , [ 1172638800000 , -0.9925349676815] , [ 1175313600000 , -1.1888941931287] , [ 1177905600000 , -1.9402228220929] , [ 1180584000000 , -2.03915987194] , [ 1183176000000 , -2.4620526931074] , [ 1185854400000 , -2.2423544651877] , [ 1188532800000 , -1.8790998536037] , [ 1191124800000 , -0.43246873489492] , [ 1193803200000 , -0.40142684216371] , [ 1196398800000 , -0.35646635110466] , [ 1199077200000 , -0.90385702817642] , [ 1201755600000 , -0.86997575249605] , [ 1204261200000 , -0.80101406775415] , [ 1206936000000 , 0] , [ 1209528000000 , 0] , [ 1212206400000 , 0] , [ 1214798400000 , -0.31816167663298] , [ 1217476800000 , -0.309250081849] , [ 1220155200000 , -0.27723698582762] , [ 1222747200000 , -0.32001379372079] , [ 1225425600000 , -0.1940212908561] , [ 1228021200000 , -0.051964569203423] , [ 1230699600000 , -0.68342686502452] , [ 1233378000000 , -0.57645644730726] , [ 1235797200000 , -0.50860972184555] , [ 1238472000000 , -0.44405217759605] , [ 1241064000000 , -0.45224333626901] , [ 1243742400000 , -0.41691818252313] , [ 1246334400000 , -2.4654561579904] , [ 1249012800000 , -2.5473566378551] , [ 1251691200000 , -2.8340604021307] , [ 1254283200000 , -1.8452445924041] , [ 1256961600000 , -1.5626544265386] , [ 1259557200000 , -1.707842764916] , [ 1262235600000 , -1.2237258567344] , [ 1264914000000 , -1.9756896168227] , [ 1267333200000 , -2.0920321696833] , [ 1270008000000 , -1.9782327706952] , [ 1272600000000 , -2.0416328165753] , [ 1275278400000 , -1.7816736134798] , [ 1277870400000 , -0.66092275437689] , [ 1280548800000 , -0.73608099025756] , [ 1283227200000 , -0.63686713461189] , [ 1285819200000 , -0.0024159482973197] , [ 1288497600000 , -0.0023052643588188] , [ 1291093200000 , -0.0023008251965446] , [ 1293771600000 , -0.002247807834351] , [ 1296450000000 , -0.62004345920743] , [ 1298869200000 , -0.69634926653235] , [ 1301544000000 , -0.76013525555354] , [ 1304136000000 , -1.505368495849] , [ 1306814400000 , -1.3456949237707] , [ 1309406400000 , -1.3013934898695] , [ 1312084800000 , -1.183199519395] , [ 1314763200000 , -0.0074317809719494] , [ 1317355200000 , -0.019430458325379] , [ 1320033600000 , -0.015777413509084] , [ 1322629200000 , -0.016463879837718] , [ 1325307600000 , -0.0031338919976225] , [ 1327986000000 , -0.0029770278967514] , [ 1330491600000 , -0.003048902987439] , [ 1333166400000 , -0.71171545945298] , [ 1335758400000 , -0.72003299240508] , [ 1338436800000 , -0.72961974845039]]
} ,
{
"key" : "Health Care" ,
"values" : [ [ 1138683600000 , 0] , [ 1141102800000 , 0] , [ 1143781200000 , 0] , [ 1146369600000 , 0] , [ 1149048000000 , 0] , [ 1151640000000 , 0] , [ 1154318400000 , 0] , [ 1156996800000 , 0] , [ 1159588800000 , 0] , [ 1162270800000 , 0] , [ 1164862800000 , 0] , [ 1167541200000 , 0] , [ 1170219600000 , 0] , [ 1172638800000 , 0] , [ 1175313600000 , 0] , [ 1177905600000 , 0] , [ 1180584000000 , 0] , [ 1183176000000 , -0.16816074963595] , [ 1185854400000 , -0.19318598121302] , [ 1188532800000 , -0.20130864403797] , [ 1191124800000 , 0] , [ 1193803200000 , 0] , [ 1196398800000 , 0] , [ 1199077200000 , 0] , [ 1201755600000 , 0] , [ 1204261200000 , 0] , [ 1206936000000 , 0] , [ 1209528000000 , 0] , [ 1212206400000 , 0] , [ 1214798400000 , -0.30476443991021] , [ 1217476800000 , -0.31836730824777] , [ 1220155200000 , -0.30797427879366] , [ 1222747200000 , -0.48318623977865] , [ 1225425600000 , -0.50834562674351] , [ 1228021200000 , -0.47936068182503] , [ 1230699600000 , -0.61753010081956] , [ 1233378000000 , -0.59493587396819] , [ 1235797200000 , -0.62664324339064] , [ 1238472000000 , 0] , [ 1241064000000 , 0] , [ 1243742400000 , 0] , [ 1246334400000 , 0] , [ 1249012800000 , 0] , [ 1251691200000 , 0] , [ 1254283200000 , -1.3076157801726] , [ 1256961600000 , -1.2306204787628] , [ 1259557200000 , -1.4728435992801] , [ 1262235600000 , -1.7729831226837] , [ 1264914000000 , -1.7711733839842] , [ 1267333200000 , -1.8233584472099] , [ 1270008000000 , -1.8505979461969] , [ 1272600000000 , -1.5989071613823] , [ 1275278400000 , -1.6636770720413] , [ 1277870400000 , -1.4523909758725] , [ 1280548800000 , -1.503771584105] , [ 1283227200000 , -1.5458561450475] , [ 1285819200000 , -1.457331837483] , [ 1288497600000 , -1.4217332434071] , [ 1291093200000 , -1.4687927303394] , [ 1293771600000 , -1.437223057967] , [ 1296450000000 , -0.72221871524334] , [ 1298869200000 , -0.7399575414588] , [ 1301544000000 , -1.9712239746745] , [ 1304136000000 , -2.2360949351942] , [ 1306814400000 , -2.2147572530541] , [ 1309406400000 , -2.0440932285023] , [ 1312084800000 , -1.9438209561938] , [ 1314763200000 , -4.9035620630386] , [ 1317355200000 , -4.9036674804213] , [ 1320033600000 , -4.1900706458801] , [ 1322629200000 , -4.5602615827955] , [ 1325307600000 , -1.9194421885814] , [ 1327986000000 , -1.8854470816382] , [ 1330491600000 , -1.9514785018245] , [ 1333166400000 , -0.65282205870454] , [ 1335758400000 , -0.57068368199209] , [ 1338436800000 , -0.55902563384907]]
} ,
{
"key" : "Industrials" ,
"values" : [ [ 1138683600000 , -0.390983707093] , [ 1141102800000 , -0.38471122730537] , [ 1143781200000 , -0.22897173467143] , [ 1146369600000 , -0.23798946472286] , [ 1149048000000 , -0.20721233428173] , [ 1151640000000 , -0.54577697700394] , [ 1154318400000 , -0.50300252995937] , [ 1156996800000 , -0.49609518628103] , [ 1159588800000 , -0.19582276889273] , [ 1162270800000 , -0.60399139945108] , [ 1164862800000 , -0.61477368082886] , [ 1167541200000 , -0.13665869881705] , [ 1170219600000 , -0.13147565243332] , [ 1172638800000 , -0.11819441593356] , [ 1175313600000 , -0.41610825689528] , [ 1177905600000 , -0.38815419659358] , [ 1180584000000 , -0.3703838943035] , [ 1183176000000 , -1.6193903804534] , [ 1185854400000 , -1.6502660417328] , [ 1188532800000 , -1.481875010149] , [ 1191124800000 , -0.96180099322536] , [ 1193803200000 , -0.97017301394967] , [ 1196398800000 , -0.97432971260093] , [ 1199077200000 , -0.36071934518387] , [ 1201755600000 , -0.42150070991777] , [ 1204261200000 , -0.41784042793202] , [ 1206936000000 , -0.70494708349169] , [ 1209528000000 , -0.73449590911984] , [ 1212206400000 , -0.7400163600788] , [ 1214798400000 , -0.52584502195668] , [ 1217476800000 , -0.56224806965368] , [ 1220155200000 , -0.50830855192741] , [ 1222747200000 , -0.79494637898049] , [ 1225425600000 , -0.70391433947286] , [ 1228021200000 , -0.61420660317009] , [ 1230699600000 , -0.41699636242004] , [ 1233378000000 , -0.3779041158185] , [ 1235797200000 , -0.34282498854047] , [ 1238472000000 , -0.83845630450592] , [ 1241064000000 , -0.85937944918912] , [ 1243742400000 , -0.85530287999615] , [ 1246334400000 , -1.2819866264007] , [ 1249012800000 , -1.4598491663715] , [ 1251691200000 , -1.5261472177779] , [ 1254283200000 , -1.2503948993549] , [ 1256961600000 , -1.1767079775724] , [ 1259557200000 , -1.2585538260386] , [ 1262235600000 , -3.420972598165] , [ 1264914000000 , -3.3381337072954] , [ 1267333200000 , -3.7043129330694] , [ 1270008000000 , -4.6924500756609] , [ 1272600000000 , -4.6880683704908] , [ 1275278400000 , -4.3335249071719] , [ 1277870400000 , -3.6545810416445] , [ 1280548800000 , -4.1639787701262] , [ 1283227200000 , -3.8249597612047] , [ 1285819200000 , -0.33221815335641] , [ 1288497600000 , -0.33346468179047] , [ 1291093200000 , -0.34546911228789] , [ 1293771600000 , -0.36609971997147] , [ 1296450000000 , -0.42502545672607] , [ 1298869200000 , -0.38192733348507] , [ 1301544000000 , -0.01991033447621] , [ 1304136000000 , -0.020319195299659] , [ 1306814400000 , -0.018147820835144] , [ 1309406400000 , -0.017923186209383] , [ 1312084800000 , -0.016133999253684] , [ 1314763200000 , -0.72058656278977] , [ 1317355200000 , -0.42812646564889] , [ 1320033600000 , -0.35896134792589] , [ 1322629200000 , -0.38637896444549] , [ 1325307600000 , -0.31794663984021] , [ 1327986000000 , -0.32220831831888] , [ 1330491600000 , -0.37107872672214] , [ 1333166400000 , -0.81968633933695] , [ 1335758400000 , -0.77148300885994] , [ 1338436800000 , -0.77392261735539]]
} ,
{
"key" : "Information Technology" ,
"values" : [ [ 1138683600000 , -0.86346955704548] , [ 1141102800000 , -0.88352373534584] , [ 1143781200000 , -1.2630802711685] , [ 1146369600000 , -1.2352593999242] , [ 1149048000000 , -1.2086379045093] , [ 1151640000000 , -1.0416778473647] , [ 1154318400000 , -0.99326278105154] , [ 1156996800000 , -1.0095045907007] , [ 1159588800000 , -2.0762515478576] , [ 1162270800000 , -2.13066829429] , [ 1164862800000 , -2.2458400474235] , [ 1167541200000 , -2.1315262677135] , [ 1170219600000 , -2.4063108252146] , [ 1172638800000 , -2.3753290631454] , [ 1175313600000 , -2.1119577565913] , [ 1177905600000 , -2.1546804750397] , [ 1180584000000 , -2.3768374034303] , [ 1183176000000 , -1.244878330098] , [ 1185854400000 , -1.2233210265236] , [ 1188532800000 , -1.1715073644317] , [ 1191124800000 , -1.0036136395928] , [ 1193803200000 , -0.9510676777939] , [ 1196398800000 , -0.97553526602196] , [ 1199077200000 , -1.9083849411912] , [ 1201755600000 , -1.855965027796] , [ 1204261200000 , -1.7343633512402] , [ 1206936000000 , -2.1847032903649] , [ 1209528000000 , -2.2095446284368] , [ 1212206400000 , -2.2060678671735] , [ 1214798400000 , -1.0941627910924] , [ 1217476800000 , -1.0004352405294] , [ 1220155200000 , -0.93563501378075] , [ 1222747200000 , 0] , [ 1225425600000 , -0.65155092645953] , [ 1228021200000 , -0.66021585164047] , [ 1230699600000 , 0] , [ 1233378000000 , 0] , [ 1235797200000 , 0] , [ 1238472000000 , 0] , [ 1241064000000 , 0] , [ 1243742400000 , 0] , [ 1246334400000 , 0] , [ 1249012800000 , 0] , [ 1251691200000 , 0] , [ 1254283200000 , -0.29297573068109] , [ 1256961600000 , -0.75043756379084] , [ 1259557200000 , -0.85690846482745] , [ 1262235600000 , -0.21937480770873] , [ 1264914000000 , -0.93232569935343] , [ 1267333200000 , -0.94180327525084] , [ 1270008000000 , 0] , [ 1272600000000 , 0] , [ 1275278400000 , 0] , [ 1277870400000 , 0] , [ 1280548800000 , 0] , [ 1283227200000 , 0] , [ 1285819200000 , -0.21253553193891] , [ 1288497600000 , -0.23178244747722] , [ 1291093200000 , -0.21481706129968] , [ 1293771600000 , -0.23306463011242] , [ 1296450000000 , -0.90244048159158] , [ 1298869200000 , -1.0410052083529] , [ 1301544000000 , -2.209350937089] , [ 1304136000000 , -2.6540796712932] , [ 1306814400000 , -3.2481210590957] , [ 1309406400000 , -3.0717986354635] , [ 1312084800000 , -2.7493296528921] , [ 1314763200000 , -2.1973991293256] , [ 1317355200000 , -0.86403111842659] , [ 1320033600000 , -0.87824756160219] , [ 1322629200000 , -0.80812571482871] , [ 1325307600000 , -1.6419820357151] , [ 1327986000000 , -1.6893790342619] , [ 1330491600000 , -1.8614499455474] , [ 1333166400000 , -1.814727017516] , [ 1335758400000 , -1.8744942128618] , [ 1338436800000 , -1.7880124850882]]
} ,
{
"key" : "Materials" ,
"values" : [ [ 1138683600000 , -0.26079769654951] , [ 1141102800000 , -0.23368425410881] , [ 1143781200000 , -0.46285283466193] , [ 1146369600000 , -0.4588429059205] , [ 1149048000000 , -0.43055120080853] , [ 1151640000000 , -0.26428963363642] , [ 1154318400000 , -0.26203611963364] , [ 1156996800000 , -0.26706156717825] , [ 1159588800000 , -0.024613610779192] , [ 1162270800000 , -0.024351047945929] , [ 1164862800000 , -0.031497065480344] , [ 1167541200000 , 0] , [ 1170219600000 , 0] , [ 1172638800000 , 0] , [ 1175313600000 , 0] , [ 1177905600000 , 0] , [ 1180584000000 , 0] , [ 1183176000000 , 0] , [ 1185854400000 , 0] , [ 1188532800000 , 0] , [ 1191124800000 , 0] , [ 1193803200000 , 0] , [ 1196398800000 , 0] , [ 1199077200000 , 0] , [ 1201755600000 , 0] , [ 1204261200000 , 0] , [ 1206936000000 , -0.83875613435932] , [ 1209528000000 , -0.84367445572656] , [ 1212206400000 , -0.78928126005463] , [ 1214798400000 , -1.1075954825404] , [ 1217476800000 , -1.2704836497926] , [ 1220155200000 , -1.307504052056] , [ 1222747200000 , -0.70440409992826] , [ 1225425600000 , -0.74122140007729] , [ 1228021200000 , -0.82224393045109] , [ 1230699600000 , -1.8719055314571] , [ 1233378000000 , -1.5200311233975] , [ 1235797200000 , -1.5552386899059] , [ 1238472000000 , -1.1576593040773] , [ 1241064000000 , -1.0757811060575] , [ 1243742400000 , -1.0250125722511] , [ 1246334400000 , -2.2747597224127] , [ 1249012800000 , -2.3125499227974] , [ 1251691200000 , -2.2784386530745] , [ 1254283200000 , -1.1518806233757] , [ 1256961600000 , -1.0075503399018] , [ 1259557200000 , -1.1400577929481] , [ 1262235600000 , -0.50677891891165] , [ 1264914000000 , -0.54332908490051] , [ 1267333200000 , -0.55473181189807] , [ 1270008000000 , -0.3633796157757] , [ 1272600000000 , -0.30361861470847] , [ 1275278400000 , -0.24614951229153] , [ 1277870400000 , -1.0959443687647] , [ 1280548800000 , -1.1881529264637] , [ 1283227200000 , -1.1835349242596] , [ 1285819200000 , -0.92507477884561] , [ 1288497600000 , -0.94531016133473] , [ 1291093200000 , -0.93519433603434] , [ 1293771600000 , -1.009221344252] , [ 1296450000000 , -2.3640716285835] , [ 1298869200000 , -2.4914494188556] , [ 1301544000000 , -1.7979456141716] , [ 1304136000000 , -2.1389760840247] , [ 1306814400000 , -1.9721362241269] , [ 1309406400000 , -1.9170229522382] , [ 1312084800000 , -1.8076246545605] , [ 1314763200000 , -2.1010686108381] , [ 1317355200000 , -2.2396373791195] , [ 1320033600000 , -1.8469012813015] , [ 1322629200000 , -2.0079125997321] , [ 1325307600000 , -1.9170007806182] , [ 1327986000000 , -1.9239118384243] , [ 1330491600000 , -2.0649464738798] , [ 1333166400000 , -0.88385747789351] , [ 1335758400000 , -0.91438087144161] , [ 1338436800000 , -0.96513752020965]]
} ,
{
"key" : "Telecommunication Services" ,
"values" : [ [ 1138683600000 , 0] , [ 1141102800000 , 0] , [ 1143781200000 , -0.077395192503573] , [ 1146369600000 , -0.079342784160835] , [ 1149048000000 , -0.07376956808809] , [ 1151640000000 , -0.041850521681201] , [ 1154318400000 , -0.037598545052499] , [ 1156996800000 , -0.040984079427717] , [ 1159588800000 , -0.19335817797448] , [ 1162270800000 , -0.18578493919925] , [ 1164862800000 , -0.1769473933101] , [ 1167541200000 , -0.57245352054975] , [ 1170219600000 , -0.61554187332911] , [ 1172638800000 , -0.63016714701151] , [ 1175313600000 , 0] , [ 1177905600000 , 0] , [ 1180584000000 , 0] , [ 1183176000000 , -0.12118014109021] , [ 1185854400000 , -0.11085831487208] , [ 1188532800000 , -0.10901265358445] , [ 1191124800000 , -0.17205583275088] , [ 1193803200000 , -0.16573676303991] , [ 1196398800000 , -0.17954841680392] , [ 1199077200000 , -0.82703336198161] , [ 1201755600000 , -0.76741763304227] , [ 1204261200000 , -0.79430844816827] , [ 1206936000000 , -1.0279404050708] , [ 1209528000000 , -1.0342425093761] , [ 1212206400000 , -1.0903083860383] , [ 1214798400000 , -1.0895432841007] , [ 1217476800000 , -1.1392703218146] , [ 1220155200000 , -0.98872086340391] , [ 1222747200000 , -1.227654651568] , [ 1225425600000 , -1.0527419580394] , [ 1228021200000 , -0.84338280322309] , [ 1230699600000 , -0.5982617279246] , [ 1233378000000 , -0.74123723862634] , [ 1235797200000 , -0.81665712408277] , [ 1238472000000 , -0.89868760705228] , [ 1241064000000 , -0.86338472153689] , [ 1243742400000 , -0.85040889603889] , [ 1246334400000 , -0.82872733882926] , [ 1249012800000 , -1.2797824676355] , [ 1251691200000 , -1.152043882336] , [ 1254283200000 , -0.70125890680538] , [ 1256961600000 , -0.69496338525418] , [ 1259557200000 , -0.81982038022784] , [ 1262235600000 , -0.42841700219624] , [ 1264914000000 , -0.43298861575253] , [ 1267333200000 , -0.46951194437705] , [ 1270008000000 , -0.46723980191721] , [ 1272600000000 , -0.43139262322841] , [ 1275278400000 , -0.4052075794202] , [ 1277870400000 , -0.45399431179247] , [ 1280548800000 , -0.50492374473014] , [ 1283227200000 , -0.49032976375464] , [ 1285819200000 , -0.95769381063728] , [ 1288497600000 , -0.92968381683254] , [ 1291093200000 , -0.90984207437415] , [ 1293771600000 , -0.91448295661871] , [ 1296450000000 , -1.3204103334172] , [ 1298869200000 , -1.3896989018] , [ 1301544000000 , -1.8536993972883] , [ 1304136000000 , -1.9901582471947] , [ 1306814400000 , -1.8731097808809] , [ 1309406400000 , -1.8109819859122] , [ 1312084800000 , -1.7946593386661] , [ 1314763200000 , -1.6002716669781] , [ 1317355200000 , -0.056479286204019] , [ 1320033600000 , -0.046232413998891] , [ 1322629200000 , -0.051182355563531] , [ 1325307600000 , -0.032858749040145] , [ 1327986000000 , -0.032326418106178] , [ 1330491600000 , -0.033980477379241] , [ 1333166400000 , -0.053069550536519] , [ 1335758400000 , -0.055741850564434] , [ 1338436800000 , -0.055851808568252]]
} ,
{
"key" : "Utilities" ,
"values" : [ [ 1138683600000 , 0] , [ 1141102800000 , 0] , [ 1143781200000 , -0.073769471773675] , [ 1146369600000 , -0.077824496315782] , [ 1149048000000 , -0.080696288096361] , [ 1151640000000 , 0] , [ 1154318400000 , 0] , [ 1156996800000 , 0] , [ 1159588800000 , 0] , [ 1162270800000 , 0] , [ 1164862800000 , 0] , [ 1167541200000 , 0] , [ 1170219600000 , 0] , [ 1172638800000 , 0] , [ 1175313600000 , 0] , [ 1177905600000 , 0] , [ 1180584000000 , 0] , [ 1183176000000 , -0.16073291656515] , [ 1185854400000 , -0.1646253606633] , [ 1188532800000 , -0.1655815581449] , [ 1191124800000 , -0.74417496631713] , [ 1193803200000 , -0.76230340423681] , [ 1196398800000 , -0.73882938190048] , [ 1199077200000 , -0.3820573391806] , [ 1201755600000 , -0.360757285179] , [ 1204261200000 , -0.38081058463615] , [ 1206936000000 , -0.92767439811083] , [ 1209528000000 , -0.92774728028789] , [ 1212206400000 , -0.85273481694714] , [ 1214798400000 , -1.69407085613] , [ 1217476800000 , -1.5179726219101] , [ 1220155200000 , -1.3576700600738] , [ 1222747200000 , -1.0404839864076] , [ 1225425600000 , -0.95251478838915] , [ 1228021200000 , -1.0610509118017] , [ 1230699600000 , -0.3316792294278] , [ 1233378000000 , -0.33745002288524] , [ 1235797200000 , -0.28806366796683] , [ 1238472000000 , 0] , [ 1241064000000 , 0] , [ 1243742400000 , 0] , [ 1246334400000 , -0.6338555382785] , [ 1249012800000 , -0.62797265130959] , [ 1251691200000 , -0.60264057253794] , [ 1254283200000 , -0.28687231077181] , [ 1256961600000 , -0.22215649778327] , [ 1259557200000 , -0.24027664555676] , [ 1262235600000 , 0] , [ 1264914000000 , 0] , [ 1267333200000 , 0] , [ 1270008000000 , 0] , [ 1272600000000 , 0] , [ 1275278400000 , 0] , [ 1277870400000 , 0] , [ 1280548800000 , 0] , [ 1283227200000 , 0] , [ 1285819200000 , 0] , [ 1288497600000 , 0] , [ 1291093200000 , 0] , [ 1293771600000 , 0] , [ 1296450000000 , 0] , [ 1298869200000 , 0] , [ 1301544000000 , 0] , [ 1304136000000 , 0] , [ 1306814400000 , 0] , [ 1309406400000 , 0] , [ 1312084800000 , 0] , [ 1314763200000 , 0] , [ 1317355200000 , 0] , [ 1320033600000 , 0] , [ 1322629200000 , 0] , [ 1325307600000 , 0] , [ 1327986000000 , 0] , [ 1330491600000 , 0] , [ 1333166400000 , 0] , [ 1335758400000 , 0] , [ 1338436800000 , 0]]
}
];
function totalRandom() {
var rval = [];
for(var n=1; n <= 2; n++) {
var series = [];
for(var i =0; i < 50; i++) {
series.push([
Math.floor(Math.random() * 100),
Math.random() * 6
]);
}
rval.push({key: "Random " + n, values: series});
}
return rval;
}
function nPoints() {
var rval = [
{key: "Series 1",
values: [
[1,2],
[2,4],
[3,8]
]}
];
return rval;
}
//an example of harmonizing colors between visualizations
//observe that Consumer Discretionary and Consumer Staples have
//been flipped in the second chart
var colors = d3.scale.category20();
var keyColor = function(d, i) {return colors(d.key)};
function defaultChartConfig(container, data, useGuideline) {
if (useGuideline === undefined) useGuideline = true;
nv.addGraph(function() {
var chart;
chart = nv.models.stackedAreaChart()
.useInteractiveGuideline(useGuideline)
.x(function(d) { return d[0] })
.y(function(d) { return d[1] })
.color(keyColor)
;
chart.xAxis
.tickFormat(function(d) { return d3.time.format('%x')(new Date(d)) });
chart.yAxis
.tickFormat(d3.format(',.2f'));
d3.select('#' + container + ' svg')
.datum(data)
.transition().duration(500).call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
}
//Chart with old tooltip format.
nv.addGraph(function() {
var chart = nv.models.stackedAreaChart()
.x(function(d) { return d[0] })
.y(function(d) { return d[1] })
.showControls(false)
.color(keyColor)
.margin({right:90})
.rightAlignYAxis(true)
;
chart.xAxis
.tickFormat(function(d) { return d3.time.format('%x')(new Date(d)) });
chart.yAxis
.tickFormat(d3.format(',.2f'));
d3.select('#chart2 svg')
.datum(histcatexpshort)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
defaultChartConfig("chart1", histcatexplong);
defaultChartConfig("chart3", histcatexplong_singledatapoint);
defaultChartConfig("chart4", histcatexplong_twodatapoint);
defaultChartConfig("chart5", histcatexplong_withholes);
defaultChartConfig("chart6", totalRandom(), false);
defaultChartConfig("chart7", nPoints(),false);
defaultChartConfig("chart8", []);
defaultChartConfig("chart9", histcatexpshort,true);
</script>

@ -1,20 +0,0 @@
//A little snippet of D3 code that creates a button that lets you toggle whether a chart is the only one visible on a page or not.
d3.selectAll(".chart button").on("click",function() {
var thisId = this.parentElement.id;
var chartContainer = d3.select("#" + thisId);
if (chartContainer.attr("class").match("selected"))
chartContainer.classed("selected",false);
else
chartContainer.classed("selected",true);
d3.selectAll(".chart").style("display",function() {
if (thisId === this.id) return "block";
if (d3.select(this).style("display") === "none")
return "block";
else
return "none";
});
window.onresize();
});

@ -1,39 +0,0 @@
body {
overflow-y:scroll;
font-family: arial;
}
text {
font: 12px sans-serif;
}
.chart {
float:left;
height: 500px;
text-align: center;
font-weight: bold;
margin-bottom: 2em;
}
.chart.full {
width: 100%;
}
.chart.half {
width: 50%;
}
.chart.third {
width: 33%;
}
.chart.selected {
width: 100% !important;
}
.navigation a{
margin-right: 1em;
}
.navigation {
margin-bottom: 1em;
}
Loading…
Cancel
Save