Skip to content

trace type indicator #3978

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

Merged
merged 15 commits into from
Jun 28, 2019
Merged
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
@@ -18,7 +18,8 @@ Plotly.register([
require('./ohlc'),
require('./candlestick'),
require('./funnel'),
require('./waterfall')
require('./waterfall'),
require('./indicator')
]);

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

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

require('./table'),

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
@@ -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'];
@@ -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])) {
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
@@ -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);

2 changes: 1 addition & 1 deletion src/snapshot/tosvg.js
Original file line number Diff line number Diff line change
@@ -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')
.attr({'data-unformatted': null, 'data-math': null})
.each(function() {
var txt = d3.select(this);
Loading