Skip to content

Commit

Permalink
Added possibility to use multiple color axis for almost all series.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppotaczek authored and ppotaczek committed Aug 19, 2019
1 parent eb582c8 commit 7689db4
Show file tree
Hide file tree
Showing 82 changed files with 2,431 additions and 459 deletions.
2 changes: 1 addition & 1 deletion errors/10/enduser.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ This error occurs in the following situations:
* If the minimum of a logarithimic axis is set to 0 or less
* If the threshold is set to 0 or less

As of Highcharts 5.0.8 it's possible to bypass this error message by setting `Axis.prototype.allowNegativeLog` to `true` and add custom conversion functions. [View Live Demo](http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/yaxis/type-log-negative/">).
As of Highcharts 5.0.8 it's possible to bypass this error message by setting `Axis.prototype.allowNegativeLog` to `true` and add custom conversion functions. [View Live Demo](http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/yaxis/type-log-negative/">). It is also possible to use a similar workaround for colorAxis. [View live demo](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/coloraxis/logarithmic-with-emulate-negative-values/).
2 changes: 2 additions & 0 deletions errors/10/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ Note: As of Highcharts 5.0.8 it's possible to bypass this error message by
setting `Axis.prototype.allowNegativeLog` to true, and add custom conversion
functions.
[View live demo](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/yaxis/type-log-negative/).
It is also possible to use a similar workaround for colorAxis.
[View live demo](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/coloraxis/logarithmic-with-emulate-negative-values/).
4 changes: 2 additions & 2 deletions errors/errors.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"10": {
"title": "Can't plot zero or subzero values on a logarithmic axis",
"text": "<h1>Can't plot zero or subzero values on a logarithmic axis</h1><p>This error occurs in the following situations: </p><ul><li>If a zero or subzero data value is added to a logarithmic axis</li><li>If the minimum of a logarithimic axis is set to 0 or less</li><li>If the threshold is set to 0 or less</li></ul><p>Note: As of Highcharts 5.0.8 it's possible to bypass this error message by setting <code>Axis.prototype.allowNegativeLog</code> to true, and add custom conversion functions. <a href=\"https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/yaxis/type-log-negative/\">View live demo</a>.</p>",
"enduser": "<h1>Can't plot zero or subzero values on a logarithmic axis</h1><p>This error occurs in the following situations:</p><ul><li>If a zero or subzero data value is added to a logarithmic axis</li><li>If the minimum of a logarithimic axis is set to 0 or less</li><li>If the threshold is set to 0 or less</li></ul><p>As of Highcharts 5.0.8 it's possible to bypass this error message by setting <code>Axis.prototype.allowNegativeLog</code> to <code>true</code> and add custom conversion functions. <a href=\"http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/yaxis/type-log-negative/\">\">View Live Demo</a>.</p>"
"text": "<h1>Can't plot zero or subzero values on a logarithmic axis</h1><p>This error occurs in the following situations: </p><ul><li>If a zero or subzero data value is added to a logarithmic axis</li><li>If the minimum of a logarithimic axis is set to 0 or less</li><li>If the threshold is set to 0 or less</li></ul><p>Note: As of Highcharts 5.0.8 it's possible to bypass this error message by setting <code>Axis.prototype.allowNegativeLog</code> to true, and add custom conversion functions. <a href=\"https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/yaxis/type-log-negative/\">View live demo</a>. It is also possible to use a similar workaround for colorAxis. <a href=\"https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/coloraxis/logarithmic-with-emulate-negative-values/\">View live demo</a>.</p>",
"enduser": "<h1>Can't plot zero or subzero values on a logarithmic axis</h1><p>This error occurs in the following situations:</p><ul><li>If a zero or subzero data value is added to a logarithmic axis</li><li>If the minimum of a logarithimic axis is set to 0 or less</li><li>If the threshold is set to 0 or less</li></ul><p>As of Highcharts 5.0.8 it's possible to bypass this error message by setting <code>Axis.prototype.allowNegativeLog</code> to <code>true</code> and add custom conversion functions. <a href=\"http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/yaxis/type-log-negative/\">\">View Live Demo</a>. It is also possible to use a similar workaround for colorAxis. <a href=\"https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/coloraxis/logarithmic-with-emulate-negative-values/\">View live demo</a>.</p>"
},
"11": {
"title": "Can't link axes of different type",
Expand Down
4 changes: 2 additions & 2 deletions js/error-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import H from './parts/Globals.js';
H.errorMessages = {
"10": {
"title": "Can't plot zero or subzero values on a logarithmic axis",
"text": "<h1>Can't plot zero or subzero values on a logarithmic axis</h1><p>This error occurs in the following situations: </p><ul><li>If a zero or subzero data value is added to a logarithmic axis</li><li>If the minimum of a logarithimic axis is set to 0 or less</li><li>If the threshold is set to 0 or less</li></ul><p>Note: As of Highcharts 5.0.8 it's possible to bypass this error message by setting <code>Axis.prototype.allowNegativeLog</code> to true, and add custom conversion functions. <a href=\"https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/yaxis/type-log-negative/\">View live demo</a>.</p>",
"enduser": "<h1>Can't plot zero or subzero values on a logarithmic axis</h1><p>This error occurs in the following situations:</p><ul><li>If a zero or subzero data value is added to a logarithmic axis</li><li>If the minimum of a logarithimic axis is set to 0 or less</li><li>If the threshold is set to 0 or less</li></ul><p>As of Highcharts 5.0.8 it's possible to bypass this error message by setting <code>Axis.prototype.allowNegativeLog</code> to <code>true</code> and add custom conversion functions. <a href=\"http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/yaxis/type-log-negative/\">\">View Live Demo</a>.</p>"
"text": "<h1>Can't plot zero or subzero values on a logarithmic axis</h1><p>This error occurs in the following situations: </p><ul><li>If a zero or subzero data value is added to a logarithmic axis</li><li>If the minimum of a logarithimic axis is set to 0 or less</li><li>If the threshold is set to 0 or less</li></ul><p>Note: As of Highcharts 5.0.8 it's possible to bypass this error message by setting <code>Axis.prototype.allowNegativeLog</code> to true, and add custom conversion functions. <a href=\"https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/yaxis/type-log-negative/\">View live demo</a>. It is also possible to use a similar workaround for colorAxis. <a href=\"https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/coloraxis/logarithmic-with-emulate-negative-values/\">View live demo</a>.</p>",
"enduser": "<h1>Can't plot zero or subzero values on a logarithmic axis</h1><p>This error occurs in the following situations:</p><ul><li>If a zero or subzero data value is added to a logarithmic axis</li><li>If the minimum of a logarithimic axis is set to 0 or less</li><li>If the threshold is set to 0 or less</li></ul><p>As of Highcharts 5.0.8 it's possible to bypass this error message by setting <code>Axis.prototype.allowNegativeLog</code> to <code>true</code> and add custom conversion functions. <a href=\"http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/yaxis/type-log-negative/\">\">View Live Demo</a>. It is also possible to use a similar workaround for colorAxis. <a href=\"https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/coloraxis/logarithmic-with-emulate-negative-values/\">View live demo</a>.</p>"
},
"11": {
"title": "Can't link axes of different type",
Expand Down
13 changes: 13 additions & 0 deletions js/masters/modules/coloraxis.src.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @license Highcharts JS [email protected]@ (@product.date@)
* @module highcharts/modules/color-axis
* @requires highcharts
*
* ColorAxis module
*
* (c) 2012-2019 Pawel Potaczek
*
* License: www.highcharts.com/license
*/
'use strict';
import '../../parts-map/ColorAxis.js';
2 changes: 1 addition & 1 deletion js/masters/modules/heatmap.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
*/
'use strict';
import '../../parts-map/ColorAxis.js';
import '../../parts-map/ColorSeriesMixin.js';
import '../../parts-map/ColorMapSeriesMixin.js';
import '../../parts-map/HeatmapSeries.js';
2 changes: 1 addition & 1 deletion js/masters/modules/map.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'use strict';
import '../../parts-map/MapAxis.js';
import '../../parts-map/ColorAxis.js';
import '../../parts-map/ColorSeriesMixin.js';
import '../../parts-map/ColorMapSeriesMixin.js';
import '../../parts-map/MapNavigation.js';
import '../../parts-map/MapPointer.js';
import '../../parts-map/MapSeries.js';
Expand Down
12 changes: 8 additions & 4 deletions js/modules/funnel.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ import '../parts/Options.js';
import '../parts/Series.js';

// create shortcuts
var seriesType = Highcharts.seriesType,
seriesTypes = Highcharts.seriesTypes,
noop = Highcharts.noop,
pick = Highcharts.pick;
var H = Highcharts,
seriesType = H.seriesType,
seriesTypes = H.seriesTypes,
fireEvent = H.fireEvent,
noop = H.noop,
pick = H.pick;

/**
* @private
Expand Down Expand Up @@ -329,6 +331,8 @@ seriesType('funnel', 'pie',
cumulative += fraction;
}
});

fireEvent(series, 'afterTranslate');
},

// Funnel items don't have angles (#2289)
Expand Down
9 changes: 5 additions & 4 deletions js/modules/networkgraph/networkgraph.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,11 @@ seriesType('networkgraph', 'line',
* Networkgraph
* @since 7.0.0
* @excluding boostThreshold, animation, animationLimit, connectEnds,
* connectNulls, dragDrop, getExtremesFromAll, label, linecap,
* negativeColor, pointInterval, pointIntervalUnit,
* pointPlacement, pointStart, softThreshold, stack, stacking,
* step, threshold, xAxis, yAxis, zoneAxis
* colorAxis, colorKey, connectNulls, dragDrop,
* getExtremesFromAll, label, linecap, negativeColor,
* pointInterval, pointIntervalUnit, pointPlacement,
* pointStart, softThreshold, stack, stacking, step,
* threshold, xAxis, yAxis, zoneAxis
* @optionparent plotOptions.networkgraph
*/
{
Expand Down
13 changes: 7 additions & 6 deletions js/modules/sankey.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,13 @@ seriesType('sankey', 'column',
* @since 6.0.0
* @product highcharts
* @excluding animationLimit, boostThreshold, borderRadius,
* crisp, cropThreshold, depth, edgeColor, edgeWidth,
* findNearestPointBy, grouping, groupPadding, groupZPadding,
* maxPointWidth, negativeColor, pointInterval,
* pointIntervalUnit, pointPadding, pointPlacement,
* pointRange, pointStart, pointWidth, shadow, softThreshold,
* stacking, threshold, zoneAxis, zones, minPointLength
* crisp, cropThreshold, colorAxis, colorKey, depth,
* edgeColor, edgeWidth, findNearestPointBy, grouping,
* groupPadding, groupZPadding, maxPointWidth, negativeColor,
* pointInterval, pointIntervalUnit, pointPadding,
* pointPlacement, pointRange, pointStart, pointWidth,
* shadow, softThreshold, stacking, threshold, zoneAxis,
* zones, minPointLength
* @optionparent plotOptions.sankey
*/
{
Expand Down
8 changes: 4 additions & 4 deletions js/modules/sunburst.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,10 @@ var cbSetTreeValuesBefore = function before(node, options) {
* Sunburst chart
*
* @extends plotOptions.pie
* @excluding allAreas, clip, colorAxis, compare, compareBase, dataGrouping,
* depth, endAngle, gapSize, gapUnit, ignoreHiddenPoint,
* innerSize, joinBy, legendType, linecap, minSize,
* navigatorOptions, pointRange
* @excluding allAreas, clip, colorAxis, colorKey, compare, compareBase,
* dataGrouping, depth, endAngle, gapSize, gapUnit,
* ignoreHiddenPoint, innerSize, joinBy, legendType, linecap,
* minSize, navigatorOptions, pointRange
* @product highcharts
* @optionparent plotOptions.sunburst
* @private
Expand Down
3 changes: 2 additions & 1 deletion js/modules/timeline.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ seriesType('timeline', 'line',
lineWidth: 2,
height: 15
},
showInLegend: false
showInLegend: false,
colorKey: 'x'
},
/**
* @lends Highcharts.Series#
Expand Down
14 changes: 6 additions & 8 deletions js/modules/treemap.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ seriesType(
*/
borderWidth: 1,

colorKey: 'colorValue',

/**
* The opacity of a point in treemap. When a point has children, the
* visibility of the children is determined by the opacity.
Expand Down Expand Up @@ -662,13 +664,11 @@ seriesType(
},
init: function (chart, options) {
var series = this,
colorSeriesMixin = H.colorSeriesMixin;
colorMapSeriesMixin = H.colorMapSeriesMixin;

// If color series logic is loaded, add some properties
if (H.colorSeriesMixin) {
this.translateColors = colorSeriesMixin.translateColors;
this.colorAttribs = colorSeriesMixin.colorAttribs;
this.axisTypes = colorSeriesMixin.axisTypes;
if (colorMapSeriesMixin) {
this.colorAttribs = colorMapSeriesMixin.colorAttribs;
}

// Handle deprecated options.
Expand Down Expand Up @@ -1237,9 +1237,7 @@ seriesType(
series.calculateChildrenAreas(tree, seriesArea);

// Logic for point colors
if (series.colorAxis) {
series.translateColors();
} else if (!options.colorByPoint) {
if (!series.colorAxis && !options.colorByPoint) {
series.setColorRecursive(series.tree);
}

Expand Down
4 changes: 4 additions & 0 deletions js/modules/windbarb.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ seriesType('windbarb', 'column'
* Pixel length of the stems.
*/
vectorLength: 20,
/**
* @default value
*/
colorKey: 'value',
/**
* Vertical offset from the cartesian position, in pixels. The default
* value makes sure the symbols don't overlap the X axis when `onSeries`
Expand Down
Loading

0 comments on commit 7689db4

Please sign in to comment.