@@ -0,0 +1,10 @@ | |||
{ | |||
"presets": [ | |||
[ | |||
"es2015", | |||
{ | |||
"modules": false | |||
} | |||
] | |||
] | |||
} |
@@ -88,7 +88,6 @@ | |||
<div class="col-sm-4"> | |||
<div id="chart-events-data" class="border data-container"> | |||
<div class="image-container border"> | |||
<img src="https://apod.nasa.gov/apod/image/1208/perseids2012_hackmann_2000.jpg"> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -0,0 +1,70 @@ | |||
{ | |||
"name": "charts", | |||
"version": "0.0.1", | |||
"lockfileVersion": 1, | |||
"requires": true, | |||
"dependencies": { | |||
"balanced-match": { | |||
"version": "1.0.0", | |||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", | |||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", | |||
"dev": true | |||
}, | |||
"brace-expansion": { | |||
"version": "1.1.8", | |||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", | |||
"integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", | |||
"dev": true, | |||
"requires": { | |||
"balanced-match": "1.0.0", | |||
"concat-map": "0.0.1" | |||
} | |||
}, | |||
"concat-map": { | |||
"version": "0.0.1", | |||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", | |||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", | |||
"dev": true | |||
}, | |||
"estree-walker": { | |||
"version": "0.2.1", | |||
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.2.1.tgz", | |||
"integrity": "sha1-va/oCVOD2EFNXcLs9MkXO225QS4=", | |||
"dev": true | |||
}, | |||
"minimatch": { | |||
"version": "3.0.4", | |||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", | |||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", | |||
"dev": true, | |||
"requires": { | |||
"brace-expansion": "1.1.8" | |||
} | |||
}, | |||
"rollup": { | |||
"version": "0.50.0", | |||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-0.50.0.tgz", | |||
"integrity": "sha512-7RqCBQ9iwsOBPkjYgoIaeUij606mSkDMExP0NT7QDI3bqkHYQHrQ83uoNIXwPcQm/vP2VbsUz3kiyZZ1qPlLTQ==", | |||
"dev": true | |||
}, | |||
"rollup-plugin-babel": { | |||
"version": "3.0.2", | |||
"resolved": "https://registry.npmjs.org/rollup-plugin-babel/-/rollup-plugin-babel-3.0.2.tgz", | |||
"integrity": "sha512-ALGPBFtwJZcYHsNPM6RGJlEncTzAARPvZOGjNPZgDe5hS5t6sJGjiOWibEFVEz5LQN7S7spvCBILaS4N1Cql2w==", | |||
"dev": true, | |||
"requires": { | |||
"rollup-pluginutils": "1.5.2" | |||
} | |||
}, | |||
"rollup-pluginutils": { | |||
"version": "1.5.2", | |||
"resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz", | |||
"integrity": "sha1-HhVud4+UtyVb+hs9AXi+j1xVJAg=", | |||
"dev": true, | |||
"requires": { | |||
"estree-walker": "0.2.1", | |||
"minimatch": "3.0.4" | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,30 @@ | |||
{ | |||
"name": "charts", | |||
"version": "0.0.1", | |||
"description": "https://frappe.github.io/charts", | |||
"main": "dist/frappe-charts.js", | |||
"directories": { | |||
"doc": "docs" | |||
}, | |||
"scripts": { | |||
"test": "mocha --compilers js:babel-core/register --colors -w ./test/*.spec.js" | |||
}, | |||
"repository": { | |||
"type": "git", | |||
"url": "git+https://github.com/frappe/charts.git" | |||
}, | |||
"keywords": [ | |||
"\"js", | |||
"charts\"" | |||
], | |||
"author": "Prateeksha Singh", | |||
"license": "MIT", | |||
"bugs": { | |||
"url": "https://github.com/frappe/charts/issues" | |||
}, | |||
"homepage": "https://github.com/frappe/charts#readme", | |||
"devDependencies": { | |||
"rollup": "^0.50.0", | |||
"rollup-plugin-babel": "^3.0.2" | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
// Rollup plugins | |||
import babel from 'rollup-plugin-babel'; | |||
export default { | |||
entry: 'src/charts.js', | |||
dest: 'dist/frappe-charts.min.js', | |||
format: 'iife', | |||
sourceMap: 'inline', | |||
plugins: [ | |||
babel({ | |||
exclude: 'node_modules/**', | |||
}), | |||
], | |||
}; |
@@ -1,5 +1,3 @@ | |||
"use strict"; | |||
let frappe = {chart:{}, chart_types:['line', 'bar', 'percentage', 'heatmap']}; | |||
frappe.chart.FrappeChart = class { | |||
@@ -1378,7 +1376,7 @@ frappe.chart.LineChart = class LineChart extends frappe.chart.AxisChart { | |||
super.setup_values(); | |||
this.unit_args = { | |||
type: 'dot', | |||
args: { radius: 4 } | |||
args: { radius: 8 } | |||
}; | |||
} | |||
@@ -1389,51 +1387,51 @@ frappe.chart.LineChart = class LineChart extends frappe.chart.AxisChart { | |||
} | |||
make_path(d, i, x_positions, y_positions, color) { | |||
let points_list = y_positions.map((y, i) => (x_positions[i] + ',' + y)); | |||
let points_str = points_list.join("L"); | |||
this.paths_groups[i].textContent = ''; | |||
d.path = $$.createSVG('path', { | |||
inside: this.paths_groups[i], | |||
className: `stroke ${color}`, | |||
d: "M"+points_str | |||
}); | |||
if(this.region_fill) { | |||
let gradient_id ='path-fill-gradient' + '-' + color; | |||
this.gradient_def = $$.createSVG('linearGradient', { | |||
inside: this.svg_defs, | |||
id: gradient_id, | |||
x1: 0, | |||
x2: 0, | |||
y1: 0, | |||
y2: 1 | |||
}); | |||
function set_gradient_stop(grad_elem, offset, color, opacity) { | |||
$$.createSVG('stop', { | |||
'className': 'stop-color ' + color, | |||
'inside': grad_elem, | |||
'offset': offset, | |||
'stop-opacity': opacity | |||
}); | |||
} | |||
set_gradient_stop(this.gradient_def, "0%", color, 0.4); | |||
set_gradient_stop(this.gradient_def, "50%", color, 0.2); | |||
set_gradient_stop(this.gradient_def, "100%", color, 0); | |||
d.region_path = $$.createSVG('path', { | |||
inside: this.paths_groups[i], | |||
className: `region-fill`, | |||
d: "M" + `0,${this.zero_line}L` + points_str + `L${this.width},${this.zero_line}`, | |||
}); | |||
d.region_path.style.stroke = "none"; | |||
d.region_path.style.fill = `url(#${gradient_id})`; | |||
} | |||
// let points_list = y_positions.map((y, i) => (x_positions[i] + ',' + y)); | |||
// let points_str = points_list.join("L"); | |||
// this.paths_groups[i].textContent = ''; | |||
// d.path = $$.createSVG('path', { | |||
// inside: this.paths_groups[i], | |||
// className: `stroke ${color}`, | |||
// d: "M"+points_str | |||
// }); | |||
// if(this.region_fill) { | |||
// let gradient_id ='path-fill-gradient' + '-' + color; | |||
// this.gradient_def = $$.createSVG('linearGradient', { | |||
// inside: this.svg_defs, | |||
// id: gradient_id, | |||
// x1: 0, | |||
// x2: 0, | |||
// y1: 0, | |||
// y2: 1 | |||
// }); | |||
// function set_gradient_stop(grad_elem, offset, color, opacity) { | |||
// $$.createSVG('stop', { | |||
// 'className': 'stop-color ' + color, | |||
// 'inside': grad_elem, | |||
// 'offset': offset, | |||
// 'stop-opacity': opacity | |||
// }); | |||
// } | |||
// set_gradient_stop(this.gradient_def, "0%", color, 0.4); | |||
// set_gradient_stop(this.gradient_def, "50%", color, 0.2); | |||
// set_gradient_stop(this.gradient_def, "100%", color, 0); | |||
// d.region_path = $$.createSVG('path', { | |||
// inside: this.paths_groups[i], | |||
// className: `region-fill`, | |||
// d: "M" + `0,${this.zero_line}L` + points_str + `L${this.width},${this.zero_line}`, | |||
// }); | |||
// d.region_path.style.stroke = "none"; | |||
// d.region_path.style.fill = `url(#${gradient_id})`; | |||
// } | |||
} | |||
} | |||