Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trace type indicator #3978

Merged
merged 15 commits into from
Jun 28, 2019
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
3 changes: 2 additions & 1 deletion lib/index-finance.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Plotly.register([
require('./ohlc'),
require('./candlestick'),
require('./funnel'),
require('./waterfall')
require('./waterfall'),
require('./indicator')
etpinard marked this conversation as resolved.
Show resolved Hide resolved
]);

module.exports = Plotly;
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Plotly.register([
require('./scattermapbox'),

require('./sankey'),
require('./indicator'),

require('./table'),

Expand Down
11 changes: 11 additions & 0 deletions lib/indicator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright 2012-2019, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

module.exports = require('../src/traces/indicator');
11 changes: 11 additions & 0 deletions src/components/modebar/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd, showSendToCloud) {
if(hasCartesian) {
hoverGroup = ['toggleSpikelines', 'hoverClosestCartesian', 'hoverCompareCartesian'];
}
if(hasNoHover(fullData)) {
hoverGroup = [];
}

if((hasCartesian || hasGL2D) && !allAxesFixed) {
zoomGroup = ['zoomIn2d', 'zoomOut2d', 'autoScale2d'];
Expand Down Expand Up @@ -216,6 +219,14 @@ function isSelectable(fullData) {
return selectable;
}

// check whether all trace are 'noHover'
function hasNoHover(fullData) {
for(var i = 0; i < fullData.length; i++) {
if(!Registry.traceIs(fullData[i], 'noHover')) return false;
}
return true;
}

function appendButtonsToGroups(groups, buttons) {
if(buttons.length) {
if(Array.isArray(buttons[0])) {
Expand Down
20 changes: 20 additions & 0 deletions src/constants/delta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright 2012-2019, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

module.exports = {
INCREASING: {
COLOR: '#3D9970',
SYMBOL: '▲'
},
DECREASING: {
COLOR: '#FF4136',
SYMBOL: '▼'
}
};
3 changes: 3 additions & 0 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3779,6 +3779,9 @@ function makePlotFramework(gd) {
// single sunburst layer for the whole plot
fullLayout._sunburstlayer = fullLayout._paper.append('g').classed('sunburstlayer', true);

// single indicator layer for the whole plot
fullLayout._indicatorlayer = fullLayout._toppaper.append('g').classed('indicatorlayer', true);

// fill in image server scrape-svg
fullLayout._glimages = fullLayout._paper.append('g').classed('glimages', true);

Expand Down
2 changes: 1 addition & 1 deletion src/snapshot/tosvg.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ module.exports = function toSVG(gd, format, scale) {
// fill whatever container it's displayed in regardless of plot size.
svg.node().style.background = '';

svg.selectAll('text')
svg.selectAll('text,tspan')
etpinard marked this conversation as resolved.
Show resolved Hide resolved
.attr({'data-unformatted': null, 'data-math': null})
.each(function() {
var txt = d3.select(this);
Expand Down
Loading