Skip to content

Commit

Permalink
Merge branch 'hc71/master' into tools/tsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
bre1470 committed Mar 6, 2019
2 parents a7e7233 + 219206c commit 48d7d59
Show file tree
Hide file tree
Showing 84 changed files with 3,971 additions and 6,891 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
/code
/errors/errors.json
/errors/errors.xml
/tools/jsdoc/ink-docstrap
/git-ignore-me.properties
/highcharts.com.sublime-project
/highcharts.com.sublime-workspace
Expand Down
11 changes: 11 additions & 0 deletions docs/dependency-wheel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Dependency wheel

A dependency wheel is a type of flow diagram, where nodes are laid out in a circle, and links are drawn between them. This width of the link and size of the nodes are proportional to the flow quantity or _weight_ of each link.

The dependency wheel's use areas are similar to the [Sankey diagram](https://www.highcharts.com/docs/chart-and-series-types/sankey-diagram), but while the Sankey diagram supports multiple columns, and there is a clear direction of flow, the dependency wheel's nodes are laid out on the same level, indicating that the flow is multidirectional.

For more detailed samples and documentation, check the [API](https://api.highcharts.com/highcharts/plotOptions.series.dependencywheel).

[iframe /samples/embed/highcharts/demo/dependency-wheel]

The data strucure, as well as the concept of nodes and links, is identical to those of the [Sankey diagram](https://www.highcharts.com/docs/chart-and-series-types/sankey-diagram).
5 changes: 3 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ const generateClassReferences = ({ templateDir, destination }) => {
'./js/modules/offline-exporting.src.js',
'./js/modules/pattern-fill.src.js',
'./js/modules/sankey.src.js',
'./js/modules/networkgraph/*.js',
'./js/modules/sonification/*.js',
'./js/annotations/annotations.src.js'
/*
Expand Down Expand Up @@ -1214,7 +1215,7 @@ const generateAPIDocs = ({ treeFile, output, onlyBuildCurrent }) => {
'./js/parts-gantt'
];
const configJSDoc = {
plugins: ['./tools/jsdoc/plugins/highcharts.jsdoc']
plugins: ['./node_modules/highcharts-documentation-generators/jsdoc/plugins/highcharts.jsdoc']
};
const jsdoc = require('gulp-jsdoc3');
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -1426,7 +1427,7 @@ const jsdocNamespace = () => {
'highmaps'
],
gulpOptions = [codeFiles, { read: false }],
jsdoc3Options = { plugins: ['tools/jsdoc/plugins/highcharts.namespace'] };
jsdoc3Options = { plugins: ['node_modules/highcharts-documentation-generators/jsdoc/plugins/highcharts.namespace'] };

if (codeFiles.length === 0) {
console.error('No files in tsconfig.json found.');
Expand Down
88 changes: 88 additions & 0 deletions js/mixins/nodes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import H from '../parts/Globals.js';

var pick = H.pick,
defined = H.defined;

H.NodesMixin = {
// Create a single node that holds information on incoming and outgoing
// links.
Expand Down Expand Up @@ -30,6 +33,16 @@ H.NodesMixin = {
node.linksFrom = [];
node.formatPrefix = 'node';
node.name = node.name || node.options.id; // for use in formats
// Mass is used in networkgraph:
node.mass = pick(
// Node:
node.options.mass,
node.options.marker && node.options.marker.radius,
// Series:
this.options.marker && this.options.marker.radius,
// Default:
4
);

// Return the largest sum of either the incoming or outgoing links.
node.getSum = function () {
Expand Down Expand Up @@ -72,5 +85,80 @@ H.NodesMixin = {
this.nodes.push(node);
}
return node;
},

// Extend generatePoints by adding the nodes, which are Point objects
// but pushed to the this.nodes array.
generatePoints: function () {
var nodeLookup = {},
chart = this.chart;

H.Series.prototype.generatePoints.call(this);

if (!this.nodes) {
this.nodes = []; // List of Point-like node items
}
this.colorCounter = 0;

// Reset links from previous run
this.nodes.forEach(function (node) {
node.linksFrom.length = 0;
node.linksTo.length = 0;
node.level = undefined;
});

// Create the node list and set up links
this.points.forEach(function (point) {
if (defined(point.from)) {
if (!nodeLookup[point.from]) {
nodeLookup[point.from] = this.createNode(point.from);
}
nodeLookup[point.from].linksFrom.push(point);
point.fromNode = nodeLookup[point.from];

// Point color defaults to the fromNode's color
if (chart.styledMode) {
point.colorIndex = pick(
point.options.colorIndex,
nodeLookup[point.from].colorIndex
);
} else {
point.color =
point.options.color || nodeLookup[point.from].color;
}

}
if (defined(point.to)) {
if (!nodeLookup[point.to]) {
nodeLookup[point.to] = this.createNode(point.to);
}
nodeLookup[point.to].linksTo.push(point);
point.toNode = nodeLookup[point.to];
}

point.name = point.name || point.id; // for use in formats
}, this);

// Store lookup table for later use
this.nodeLookup = nodeLookup;
},

// Destroy all nodes on setting new data
setData: function () {
if (this.nodes) {
this.nodes.forEach(function (node) {
node.destroy();
});
this.nodes.length = 0;
}
H.Series.prototype.setData.apply(this, arguments);
},

// Destroy alll nodes and links
destroy: function () {
// Nodes must also be destroyed (#8682, #9300)
this.data = [].concat(this.points, this.nodes);

return H.Series.prototype.destroy.apply(this, arguments);
}
};
Loading

0 comments on commit 48d7d59

Please sign in to comment.