-
-
Notifications
You must be signed in to change notification settings - Fork 543
Open
Description
For longer legend labels, the character at the end gets cutoff slightly:
I noticed that padding one of the lines with spaces seems to fix the problem:
Here is the code that we use to render the plot, with the spaces added (2nd line):
// Extra space on legend keys is a workaround for plotly cutting off the last character
const oldBars = bar(getOldData(metrics).reverse(), names, `Submitted before ${cutoff} `, OldColor);
const newBars = bar(getNewData(metrics).reverse(), names, `Submitted since ${cutoff}`, NewColor);
const bar = (values, labels, name, color) => ({
type: 'bar',
y: labels,
x: values,
hoverinfo: 'x',
orientation: 'h',
marker: { color },
name,
});
<Plot
data={[newBars, oldBars]}
layout={{
autosize: false,
barmode: 'stack',
width: 900,
height: 600,
margin: { l: 5, r: 0, t: 0, b: 60, pad: 1 },
xaxis: {
fixedrange: true,
showline: false,
showticklabels: false,
zeroline: false
},
yaxis: {
fixedrange: true,
showline: true,
showgrid: true,
showticklabels: false,
zeroline: false
},
legend: {
font: {
color: 'black',
family: 'Helvetica',
size: 16
},
traceorder: 'grouped'
}
}}
config={{
displayModeBar: false,
scrollZoom: false,
showAxisDragHandles: false,
showAxisRangeEntryBoxes: false,
sendData: false
}}
onClick={handleClick}
/>
aij, agoldparker, rutabagaist, andymli and andoksandoks
Metadata
Metadata
Assignees
Labels
No labels