Skip to content

Commit c50e4c6

Browse files
committed
Rasterizer works except for sizing
1 parent adc4eb4 commit c50e4c6

12 files changed

+456
-193
lines changed

.swp

12 KB
Binary file not shown.

build/app.js

+99-95
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
/*globals require */
4949
'use strict';
5050
__webpack_require__(1);
51-
var d3 = __webpack_require__(3);
51+
var d3 = __webpack_require__(5);
5252
var moment = __webpack_require__(2);
53-
__webpack_require__(5);
53+
__webpack_require__(3);
5454

5555
/***/ },
5656
/* 1 */
@@ -121,6 +121,31 @@
121121

122122
/***/ },
123123
/* 3 */
124+
/***/ function(module, exports, __webpack_require__) {
125+
126+
"use strict";
127+
/*jshint esnext:true, eqnull:true */
128+
/*globals require */
129+
var getObjects = __webpack_require__(6).getObjects;
130+
var Chart = __webpack_require__(7).Chart;
131+
var SmallMultiplesChart = __webpack_require__(8).SmallMultiplesChart;
132+
var LargeChart = __webpack_require__(9).LargeChart;
133+
var nv = __webpack_require__(16);
134+
getObjects('report.json', function (charts) {
135+
charts = charts.map( function(graph) {
136+
return Chart(graph);
137+
} )
138+
window.charts = charts;
139+
140+
var small_div = d3.select('#small-chart-div-test_numero_dos');
141+
var lg_div = d3.select('#chart-div-test_numero_dos');
142+
nv.addGraph(SmallMultiplesChart(charts[0], small_div));
143+
nv.addGraph(LargeChart(charts[0], lg_div));
144+
});
145+
146+
/***/ },
147+
/* 4 */,
148+
/* 5 */
124149
/***/ function(module, exports, __webpack_require__) {
125150

126151
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;!function() {
@@ -9339,31 +9364,6 @@
93399364
this.d3 = d3;
93409365
}();
93419366

9342-
/***/ },
9343-
/* 4 */,
9344-
/* 5 */
9345-
/***/ function(module, exports, __webpack_require__) {
9346-
9347-
"use strict";
9348-
/*jshint esnext:true, eqnull:true */
9349-
/*globals require */
9350-
var getObjects = __webpack_require__(6).getObjects;
9351-
var Chart = __webpack_require__(7).Chart;
9352-
var SmallMultiplesChart = __webpack_require__(8).SmallMultiplesChart;
9353-
var LargeChart = __webpack_require__(11).LargeChart;
9354-
var nv = __webpack_require__(16);
9355-
getObjects('report.json', function (charts) {
9356-
charts = charts.map( function(graph) {
9357-
return Chart(graph);
9358-
} )
9359-
window.charts = charts;
9360-
9361-
var small_div = d3.select('#small-chart-div-test_numero_dos');
9362-
var lg_div = d3.select('#chart-div-test_numero_dos');
9363-
nv.addGraph(SmallMultiplesChart(charts[0], small_div));
9364-
nv.addGraph(LargeChart(charts[0], lg_div));
9365-
});
9366-
93679367
/***/ },
93689368
/* 6 */
93699369
/***/ function(module, exports, __webpack_require__) {
@@ -9629,7 +9629,7 @@
96299629
'use strict';
96309630
var Klass = __webpack_require__(13).Klass;
96319631
var dataSym = Symbol();
9632-
var d3 = __webpack_require__(3);
9632+
var d3 = __webpack_require__(5);
96339633

96349634
var dataPointSchema = __webpack_require__(14).dataPointSchema;
96359635
var timeDataPointSchema = __webpack_require__(14).timeDataPointSchema;
@@ -10025,7 +10025,7 @@
1002510025
/*globals require */
1002610026
var $__Array$prototype$slice = Array.prototype.slice;
1002710027
var moment = __webpack_require__(2);
10028-
var d3 = __webpack_require__(3);
10028+
var d3 = __webpack_require__(5);
1002910029
var nv = __webpack_require__(16);
1003010030
var shapePath = __webpack_require__(15).shapePath;
1003110031
var shapes = __webpack_require__(15).shapes;
@@ -10357,6 +10357,68 @@
1035710357

1035810358
/***/ },
1035910359
/* 9 */
10360+
/***/ function(module, exports, __webpack_require__) {
10361+
10362+
"use strict";
10363+
/*jshint esnext:true, eqnull:true */
10364+
/*globals require */
10365+
var moment = __webpack_require__(2);
10366+
var nv = __webpack_require__(16);
10367+
var styleSheet = __webpack_require__(6).styleSheet;
10368+
var timeLineChart = __webpack_require__(10).timeLineChart;
10369+
var timeBarChart = __webpack_require__(11).timeBarChart;
10370+
10371+
function LargeChart(mschart, node) {
10372+
node = node || d3.select('body').append('div');
10373+
if(!node.attr('id')) node.attr('id', 'chart-div-' + (mschart.uid || Math.floor(Math.random() * 1000)));
10374+
var parentNode = node;
10375+
node = parentNode.append('div')
10376+
.classed('chart-div', true)
10377+
.style("width", mschart.width + mschart.width_units);
10378+
10379+
var relative = (mschart.width_units == '%');
10380+
var ratio = mschart.aspect_ratio ? (mschart.aspect_ratio[1] / mschart.aspect_ratio[0]) : undefined;
10381+
var yMax, xMax;
10382+
if(relative) {
10383+
yMax = mschart.range_max - mschart.range_min;
10384+
xMax = ratio * (mschart.range_max - mschart.range_min);
10385+
} else {
10386+
if(!ratio) {
10387+
yMax = mschart.height;
10388+
xMax = mschart.width;
10389+
} else {
10390+
yMax = ratio * mschart.width;
10391+
xMax = mschart.width;
10392+
}
10393+
}
10394+
10395+
if(relative) {
10396+
if(ratio)
10397+
styleSheet.insertRule (
10398+
"#" + parentNode.attr('id') + " .chart-div::after {" +
10399+
'content: "";' +
10400+
'display: block;' +
10401+
("margin-top: " + ratio * 100 + "%;") +
10402+
'}', styleSheet.cssRules.length
10403+
);
10404+
else
10405+
node.style('height', mschart.height + mschart.height_units);
10406+
} else {
10407+
if(!ratio) node.style('height', mschart.height + mschart.height_units);
10408+
else node.style('height', (ratio * mschart.width) + 'px')
10409+
}
10410+
10411+
node = node.append('svg')
10412+
.attr('class', 'upiq-chart chart-svg');
10413+
10414+
var margins = mschart.margins = {top: 10, bottom: 75, left: 40, right: 10};
10415+
node.outerNode = parentNode;
10416+
return mschart.chart_type == 'line' ? timeLineChart(mschart, node) : timeBarChart(mschart, node);
10417+
}
10418+
exports.LargeChart = LargeChart;
10419+
10420+
/***/ },
10421+
/* 10 */
1036010422
/***/ function(module, exports, __webpack_require__) {
1036110423

1036210424
"use strict";
@@ -10909,7 +10971,7 @@
1090910971
exports.timeLineChart = timeLineChart;
1091010972

1091110973
/***/ },
10912-
/* 10 */
10974+
/* 11 */
1091310975
/***/ function(module, exports, __webpack_require__) {
1091410976

1091510977
"use strict";
@@ -11324,7 +11386,11 @@
1132411386
.attr('y', "" + lineCt + "em")
1132511387
.attr('x', 72.5)
1132611388
.style('text-anchor', 'middle')
11327-
.text("" + format(pt.value / 100) + " (" + pt.title + ")");
11389+
.text("" + format(pt.value / 100) + " (" + pt.title + ")")
11390+
.classed('svg-link', !!pt.uri)
11391+
.on('click', pt.uri ? function() {
11392+
return window.open(pt.uri);
11393+
} : undefined);
1132811394
var height = el.node().getBoundingClientRect().height + 5;
1132911395
el.select('rect').attr('height', height);
1133011396
el.append('circle')
@@ -11375,7 +11441,7 @@
1137511441
y: datapoint.value,
1137611442
note: datapoint.note,
1137711443
title: datapoint.title,
11378-
url: datapoint.uri,
11444+
uri: datapoint.uri,
1137911445
seriesIndex: index
1138011446
});
1138111447
else
@@ -11393,68 +11459,6 @@
1139311459
} }
1139411460
exports.timeBarChart = timeBarChart;
1139511461

11396-
/***/ },
11397-
/* 11 */
11398-
/***/ function(module, exports, __webpack_require__) {
11399-
11400-
"use strict";
11401-
/*jshint esnext:true, eqnull:true */
11402-
/*globals require */
11403-
var moment = __webpack_require__(2);
11404-
var nv = __webpack_require__(16);
11405-
var styleSheet = __webpack_require__(6).styleSheet;
11406-
var timeLineChart = __webpack_require__(9).timeLineChart;
11407-
var timeBarChart = __webpack_require__(10).timeBarChart;
11408-
11409-
function LargeChart(mschart, node) {
11410-
node = node || d3.select('body').append('div');
11411-
if(!node.attr('id')) node.attr('id', 'chart-div-' + (mschart.uid || Math.floor(Math.random() * 1000)));
11412-
var parentNode = node;
11413-
node = parentNode.append('div')
11414-
.classed('chart-div', true)
11415-
.style("width", mschart.width + mschart.width_units);
11416-
11417-
var relative = (mschart.width_units == '%');
11418-
var ratio = mschart.aspect_ratio ? (mschart.aspect_ratio[1] / mschart.aspect_ratio[0]) : undefined;
11419-
var yMax, xMax;
11420-
if(relative) {
11421-
yMax = mschart.range_max - mschart.range_min;
11422-
xMax = ratio * (mschart.range_max - mschart.range_min);
11423-
} else {
11424-
if(!ratio) {
11425-
yMax = mschart.height;
11426-
xMax = mschart.width;
11427-
} else {
11428-
yMax = ratio * mschart.width;
11429-
xMax = mschart.width;
11430-
}
11431-
}
11432-
11433-
if(relative) {
11434-
if(ratio)
11435-
styleSheet.insertRule (
11436-
"#" + parentNode.attr('id') + " .chart-div::after {" +
11437-
'content: "";' +
11438-
'display: block;' +
11439-
("margin-top: " + ratio * 100 + "%;") +
11440-
'}', styleSheet.cssRules.length
11441-
);
11442-
else
11443-
node.style('height', mschart.height + mschart.height_units);
11444-
} else {
11445-
if(!ratio) node.style('height', mschart.height + mschart.height_units);
11446-
else node.style('height', (ratio * mschart.width) + 'px')
11447-
}
11448-
11449-
node = node.append('svg')
11450-
.attr('class', 'upiq-chart chart-svg');
11451-
11452-
var margins = mschart.margins = {top: 10, bottom: 75, left: 40, right: 10};
11453-
node.outerNode = parentNode;
11454-
return mschart.chart_type == 'line' ? timeLineChart(mschart, node) : timeBarChart(mschart, node);
11455-
}
11456-
exports.LargeChart = LargeChart;
11457-
1145811462
/***/ },
1145911463
/* 12 */
1146011464
/***/ function(module, exports, __webpack_require__) {
@@ -12520,7 +12524,7 @@
1252012524
/***/ function(module, exports, __webpack_require__) {
1252112525

1252212526
/*** IMPORTS FROM imports-loader ***/
12523-
var d3 = __webpack_require__(3);
12527+
var d3 = __webpack_require__(5);
1252412528

1252512529
(function(){
1252612530

build/headless.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>UPIQ Demo</title>
6+
<link rel="stylesheet" href="css/app.css">
7+
</head>
8+
<body>
9+
<script src="headless.js"></script>
10+
<div id="chart-div"></div>
11+
</body>
12+
</html>

0 commit comments

Comments
 (0)