Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12dbdf369f | ||
|
|
fc52299b2b | ||
|
|
0089b61b54 | ||
|
|
e7e78201bf | ||
|
|
6288745b3b | ||
|
|
de6345e2e4 | ||
|
|
682ff28543 |
3
.github/FUNDING.yml
vendored
Normal file
3
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: gionkunz
|
||||||
27
dist/chartist.js
vendored
27
dist/chartist.js
vendored
@ -15,7 +15,7 @@
|
|||||||
}(this, function () {
|
}(this, function () {
|
||||||
|
|
||||||
/* Chartist.js 0.11.4
|
/* Chartist.js 0.11.4
|
||||||
* Copyright © 2019 Gion Kunz
|
* Copyright © 2020 Gion Kunz
|
||||||
* Free to use under either the WTFPL license or the MIT license.
|
* Free to use under either the WTFPL license or the MIT license.
|
||||||
* https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-WTFPL
|
* https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-WTFPL
|
||||||
* https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-MIT
|
* https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-MIT
|
||||||
@ -3326,6 +3326,8 @@ var Chartist = {
|
|||||||
showPoint: true,
|
showPoint: true,
|
||||||
// If the line chart should draw an area
|
// If the line chart should draw an area
|
||||||
showArea: false,
|
showArea: false,
|
||||||
|
// If the line chart series should be stacked
|
||||||
|
stackedLine: false,
|
||||||
// The base for the area chart that will be used to close the area shape (is normally 0)
|
// The base for the area chart that will be used to close the area shape (is normally 0)
|
||||||
areaBase: 0,
|
areaBase: 0,
|
||||||
// Specify if the lines should be smoothed. This value can be true or false where true will result in smoothing using the default smoothing interpolation function Chartist.Interpolation.cardinal and false results in Chartist.Interpolation.none. You can also choose other smoothing / interpolation functions available in the Chartist.Interpolation module, or write your own interpolation function. Check the examples for a brief description.
|
// Specify if the lines should be smoothed. This value can be true or false where true will result in smoothing using the default smoothing interpolation function Chartist.Interpolation.cardinal and false results in Chartist.Interpolation.none. You can also choose other smoothing / interpolation functions available in the Chartist.Interpolation module, or write your own interpolation function. Check the examples for a brief description.
|
||||||
@ -3371,7 +3373,23 @@ var Chartist = {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function createChart(options) {
|
function createChart(options) {
|
||||||
var data = Chartist.normalizeData(this.data, options.reverseData, true);
|
|
||||||
|
var dataToNormalize = this.data;
|
||||||
|
if (options.stackedLine) {
|
||||||
|
var dataCopy = JSON.parse(JSON.stringify(this.data));
|
||||||
|
for (var i=0; i<this.data.series.length; i++) {
|
||||||
|
dataCopy.series[i].className = this.data.series[i].className;
|
||||||
|
}
|
||||||
|
for (var i=1; i<dataCopy.series.length; i++) {
|
||||||
|
for (var j=0; j<dataCopy.series[i].length; j++) {
|
||||||
|
dataCopy.series[i][j] += dataCopy.series[i-1][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataCopy.series.reverse();
|
||||||
|
dataToNormalize = dataCopy;
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = Chartist.normalizeData(dataToNormalize, options.reverseData, true);
|
||||||
|
|
||||||
// Create new svg object
|
// Create new svg object
|
||||||
this.svg = Chartist.createSvg(this.container, options.width, options.height, options.classNames.chart);
|
this.svg = Chartist.createSvg(this.container, options.width, options.height, options.classNames.chart);
|
||||||
@ -3419,9 +3437,10 @@ var Chartist = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Use series class from series data or if not set generate one
|
// Use series class from series data or if not set generate one
|
||||||
|
var relativeSeriesIndex = options.stackedLine? data.raw.series.length - 1 - seriesIndex : seriesIndex;
|
||||||
seriesElement.addClass([
|
seriesElement.addClass([
|
||||||
options.classNames.series,
|
options.classNames.series,
|
||||||
(series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex))
|
(series.className || options.classNames.series + '-' + Chartist.alphaNumerate(relativeSeriesIndex))
|
||||||
].join(' '));
|
].join(' '));
|
||||||
|
|
||||||
var pathCoordinates = [],
|
var pathCoordinates = [],
|
||||||
@ -3812,7 +3831,7 @@ var Chartist = {
|
|||||||
var seriesGroup = this.svg.elem('g');
|
var seriesGroup = this.svg.elem('g');
|
||||||
var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);
|
var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);
|
||||||
|
|
||||||
if(options.stackBars && data.normalized.series.length !== 0) {
|
if(options.stackBars && (options.stackMode === 'accumulate' || !options.stackMode) && data.normalized.series.length !== 0) {
|
||||||
|
|
||||||
// If stacked bars we need to calculate the high low from stacked values from each series
|
// If stacked bars we need to calculate the high low from stacked values from each series
|
||||||
var serialSums = Chartist.serialMap(data.normalized.series, function serialSums() {
|
var serialSums = Chartist.serialMap(data.normalized.series, function serialSums() {
|
||||||
|
|||||||
2
dist/chartist.min.css
vendored
2
dist/chartist.min.css
vendored
File diff suppressed because one or more lines are too long
6
dist/chartist.min.js
vendored
6
dist/chartist.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/chartist.min.js.map
vendored
2
dist/chartist.min.js.map
vendored
File diff suppressed because one or more lines are too long
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "chartist",
|
"name": "chartist",
|
||||||
"version": "0.11.3",
|
"version": "0.11.4",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "chartist",
|
"name": "@mempool/chartist",
|
||||||
"title": "Chartist.js",
|
"title": "Chartist.js",
|
||||||
"description": "Simple, responsive charts",
|
"description": "Simple, responsive charts",
|
||||||
"version": "0.11.4",
|
"version": "0.11.4",
|
||||||
|
|||||||
@ -140,7 +140,7 @@
|
|||||||
var seriesGroup = this.svg.elem('g');
|
var seriesGroup = this.svg.elem('g');
|
||||||
var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);
|
var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);
|
||||||
|
|
||||||
if(options.stackBars && data.normalized.series.length !== 0) {
|
if(options.stackBars && (options.stackMode === 'accumulate' || !options.stackMode) && data.normalized.series.length !== 0) {
|
||||||
|
|
||||||
// If stacked bars we need to calculate the high low from stacked values from each series
|
// If stacked bars we need to calculate the high low from stacked values from each series
|
||||||
var serialSums = Chartist.serialMap(data.normalized.series, function serialSums() {
|
var serialSums = Chartist.serialMap(data.normalized.series, function serialSums() {
|
||||||
|
|||||||
@ -72,6 +72,8 @@
|
|||||||
showPoint: true,
|
showPoint: true,
|
||||||
// If the line chart should draw an area
|
// If the line chart should draw an area
|
||||||
showArea: false,
|
showArea: false,
|
||||||
|
// If the line chart series should be stacked
|
||||||
|
stackedLine: false,
|
||||||
// The base for the area chart that will be used to close the area shape (is normally 0)
|
// The base for the area chart that will be used to close the area shape (is normally 0)
|
||||||
areaBase: 0,
|
areaBase: 0,
|
||||||
// Specify if the lines should be smoothed. This value can be true or false where true will result in smoothing using the default smoothing interpolation function Chartist.Interpolation.cardinal and false results in Chartist.Interpolation.none. You can also choose other smoothing / interpolation functions available in the Chartist.Interpolation module, or write your own interpolation function. Check the examples for a brief description.
|
// Specify if the lines should be smoothed. This value can be true or false where true will result in smoothing using the default smoothing interpolation function Chartist.Interpolation.cardinal and false results in Chartist.Interpolation.none. You can also choose other smoothing / interpolation functions available in the Chartist.Interpolation module, or write your own interpolation function. Check the examples for a brief description.
|
||||||
@ -117,7 +119,23 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function createChart(options) {
|
function createChart(options) {
|
||||||
var data = Chartist.normalizeData(this.data, options.reverseData, true);
|
|
||||||
|
var dataToNormalize = this.data;
|
||||||
|
if (options.stackedLine) {
|
||||||
|
var dataCopy = JSON.parse(JSON.stringify(this.data));
|
||||||
|
for (var i=0; i<this.data.series.length; i++) {
|
||||||
|
dataCopy.series[i].className = this.data.series[i].className;
|
||||||
|
}
|
||||||
|
for (var i=1; i<dataCopy.series.length; i++) {
|
||||||
|
for (var j=0; j<dataCopy.series[i].length; j++) {
|
||||||
|
dataCopy.series[i][j] += dataCopy.series[i-1][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataCopy.series.reverse();
|
||||||
|
dataToNormalize = dataCopy;
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = Chartist.normalizeData(dataToNormalize, options.reverseData, true);
|
||||||
|
|
||||||
// Create new svg object
|
// Create new svg object
|
||||||
this.svg = Chartist.createSvg(this.container, options.width, options.height, options.classNames.chart);
|
this.svg = Chartist.createSvg(this.container, options.width, options.height, options.classNames.chart);
|
||||||
@ -165,9 +183,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Use series class from series data or if not set generate one
|
// Use series class from series data or if not set generate one
|
||||||
|
var relativeSeriesIndex = options.stackedLine? data.raw.series.length - 1 - seriesIndex : seriesIndex;
|
||||||
seriesElement.addClass([
|
seriesElement.addClass([
|
||||||
options.classNames.series,
|
options.classNames.series,
|
||||||
(series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex))
|
(series.className || options.classNames.series + '-' + Chartist.alphaNumerate(relativeSeriesIndex))
|
||||||
].join(' '));
|
].join(' '));
|
||||||
|
|
||||||
var pathCoordinates = [],
|
var pathCoordinates = [],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user