I have a plotly boxplot chart with array of many values and all works well, but I want to highlight one value.
this is my code
var ebitda_margin_plotly = {
x: data.plotly_data.ebitda_margin,
type: 'box',
name: 'E-MARGIN',
marker: {
color: 'rgba(255, 202, 3, 0.7)',
outliercolor: 'rgba(219, 64, 82, 0.6)',
line: {
outliercolor: 'rgba(219, 64, 82, 1.0)',
outlierwidth: 2
}
},
boxpoints: 'suspectedoutliers'
};
var ebitda_margin_config = {
responsive: true,
modeBarButtonsToRemove: ['pan2d','select2d','lasso2d','resetScale2d'],
displaylogo: false,
autosizable: true
}
var layout_ebitda_margin = {
title: ('EBITDA MARGIN: ' + data.data.ebitda_margin + "%")
};
Plotly.newPlot('ebitda_margin_plotly', [ebitda_margin_plotly], layout_ebitda_margin,ebitda_margin_config);
how can I add line like this blue which will represent my custom value ? in thiscase 11.7% I have from backend
ok I found a solution, which is actually pretty simple
just need to add to layout shapes
var layout_ebitda_margin = {
title: "EBITDA MARGIN",
height: 320,
xaxis: {
rangeslider: {}
},
yaxis: {
showticklabels: false,
fixedrange: true
},
hovermode: 'y unified',
shapes: [
{
type: 'line',
x0: data.data.ebitda_margin,
y0: -1,
x1: data.data.ebitda_margin,
y1: 1,
line:{
color: 'rgb(255, 0, 0)',
width: 1,
dash:'dot'
}} ]
};