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
8 changes: 7 additions & 1 deletion src/traces/bar/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,11 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
if(!texttemplate) return '';
var isWaterfall = (trace.type === 'waterfall');
var isFunnel = (trace.type === 'funnel');
var isHorizontal = trace.orientation === 'h';

var pLetter, pAxis;
var vLetter, vAxis;
if(trace.orientation === 'h') {
if(isHorizontal) {
pLetter = 'y';
pAxis = ya;
vLetter = 'x';
Expand Down Expand Up @@ -669,6 +670,11 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
var pt = {};
appendArrayPointValue(pt, trace, cdi.i);

if(pt.x === undefined) pt.x = isHorizontal ? obj.value : obj.label;
if(pt.y === undefined) pt.y = isHorizontal ? obj.label : obj.value;
if(pt.xLabel === undefined) pt.xLabel = isHorizontal ? obj.valueLabel : obj.labelLabel;
if(pt.yLabel === undefined) pt.yLabel = isHorizontal ? obj.labelLabel : obj.valueLabel;

if(isWaterfall) {
obj.delta = +cdi.rawS || cdi.s;
obj.deltaLabel = formatNumber(obj.delta);
Expand Down
5 changes: 3 additions & 2 deletions src/traces/histogram/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ var getBinSpanLabelRound = require('./bin_label_vals');
function calc(gd, trace) {
var pos = [];
var size = [];
var pa = Axes.getFromId(gd, trace.orientation === 'h' ? trace.yaxis : trace.xaxis);
var mainData = trace.orientation === 'h' ? 'y' : 'x';
var isHorizontal = trace.orientation === 'h';
var pa = Axes.getFromId(gd, isHorizontal ? trace.yaxis : trace.xaxis);
var mainData = isHorizontal ? 'y' : 'x';
var counterData = {x: 'y', y: 'x'}[mainData];
var calendar = trace[mainData + 'calendar'];
var cumulativeSpec = trace.cumulative;
Expand Down
Binary file modified test/image/baselines/bar-marker-line-colorscales.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/image/baselines/bar_marker_array.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/image/baselines/date_histogram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test/image/mocks/bar-marker-line-colorscales.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"data": [
{
"texttemplate": "%{x}",
"marker": {
"color": [
0,
Expand Down
2 changes: 2 additions & 0 deletions test/image/mocks/bar_marker_array.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"data": [
{
"texttemplate": "%{y:(}",
"textfont": { "size": 32 },
"x": [
1,
2,
Expand Down
1 change: 1 addition & 0 deletions test/image/mocks/date_histogram.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"data": [
{
"texttemplate": "<b>%{y:.1f}</b><br><br>%{x}",
"x": [
"2012-01-01 00:00:00",
"2012-02-01 00:00:00",
Expand Down
2 changes: 1 addition & 1 deletion test/image/mocks/histogram_colorscale.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"cmax": 5
},
"x": [ 0, 1, 1, 2, 2, 2, 3, 3, 4 ],
"texttemplate": "%{value}",
"texttemplate": "%{y}",
"textposition": "inside",
"textfont": {
"size": 64
Expand Down