Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
722 changes: 238 additions & 484 deletions package-lock.json

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chartjs-chart-sankey",
"version": "0.3.2",
"version": "0.4.0",
"description": "Chart.js module for creating sankey diagrams",
"main": "dist/chartjs-chart-sankey.js",
"module": "dist/chartjs-chart-sankey.esm.js",
Expand Down Expand Up @@ -32,33 +32,33 @@
},
"homepage": "https://github.com/kurkle/chartjs-chart-sankey#readme",
"devDependencies": {
"@rollup/plugin-node-resolve": "^11.1.1",
"chart.js": "^3.0.0-beta.10",
"chartjs-adapter-date-fns": "^1.1.0-alpha.3",
"chartjs-test-utils": "^0.2.1",
"concurrently": "^5.3.0",
"@rollup/plugin-node-resolve": "^11.2.0",
"chart.js": "^3.0.0-rc.2",
"chartjs-adapter-date-fns": "^1.1.0-beta.1",
"chartjs-test-utils": "^0.2.2",
"concurrently": "^6.0.0",
"cross-env": "^7.0.3",
"date-fns": "^2.17.0",
"eslint": "^7.19.0",
"date-fns": "^2.19.0",
"eslint": "^7.22.0",
"eslint-config-chartjs": "^0.3.0",
"eslint-plugin-es": "^4.1.0",
"eslint-plugin-html": "^6.1.1",
"jasmine-core": "^3.6.0",
"karma": "^6.1.0",
"eslint-plugin-html": "^6.1.2",
"jasmine-core": "^3.7.1",
"karma": "^6.2.0",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "^2.0.3",
"karma-firefox-launcher": "^2.1.0",
"karma-jasmine": "^4.0.1",
"karma-jasmine-html-reporter": "^1.5.4",
"karma-rollup-preprocessor": "^7.0.5",
"karma-rollup-preprocessor": "^7.0.7",
"karma-spec-reporter": "0.0.32",
"merge2": "^1.4.1",
"rollup": "^2.38.5",
"rollup": "^2.42.1",
"rollup-plugin-istanbul": "^3.0.0",
"rollup-plugin-terser": "^7.0.2"
},
"peerDependencies": {
"chart.js": "^3.0.0-beta.10"
"chart.js": "^3.0.0-rc.2"
},
"dependencies": {}
}
75 changes: 35 additions & 40 deletions src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,53 +227,48 @@ export default class SankeyController extends DatasetController {
SankeyController.id = 'sankey';
SankeyController.defaults = {
dataElementType: 'flow',
dataElementOptions: [
'colorFrom',
'colorTo'
],
interaction: {
mode: 'nearest',
intersect: true
animations: {
numbers: {
type: 'number',
properties: ['x', 'y', 'x2', 'y2', 'height']
},
progress: {
easing: 'linear',
duration: (ctx) => ctx.type === 'data' ? (ctx.parsed._custom.x - ctx.parsed.x) * 200 : undefined,
delay: (ctx) => ctx.type === 'data' ? ctx.parsed.x * 500 + ctx.dataIndex * 20 : undefined,
},
colors: {
type: 'color',
properties: ['colorFrom', 'colorTo'],
},
},
datasets: {
animation: (ctx) => {
let delay = 0;
let duration = 0;
const parsed = ctx.chart.getDatasetMeta(ctx.datasetIndex).controller.getParsed(ctx.dataIndex);
if (parsed) {
delay = parsed.x * 500 + ctx.dataIndex * 20;
duration = (parsed._custom.x - parsed.x) * 200;
transitions: {
hide: {
animations: {
colors: {
type: 'color',
properties: ['colorFrom', 'colorTo'],
to: 'transparent'
}
}
return {
numbers: {
type: 'number',
properties: ['x', 'y', 'x2', 'y2', 'height']
},
progress: {
easing: 'linear',
duration,
delay
},
},
show: {
animations: {
colors: {
type: 'color',
properties: ['colorFrom', 'colorTo'],
},
hide: {
colors: {
type: 'color',
properties: ['colorFrom', 'colorTo'],
to: 'transparent'
}
},
show: {
colors: {
type: 'color',
properties: ['colorFrom', 'colorTo'],
from: 'transparent'
}
from: 'transparent'
}
};
}
},
}
};
SankeyController.overrides = {
interaction: {
mode: 'nearest',
intersect: true
},
datasets: {
color: () => '#efefef',
clip: false,
parsing: true
Expand Down
Binary file modified test/fixtures/basic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/border.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/energy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/issue13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/labels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/no-border.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/nodeWidth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/priority.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.