Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

296
Visualizações
Format Plotly Annotation properly

I am showing annotations by clicking on a plotly chart. Now I would like to align the lines to look better. The indentations should be the same for every line. It comes clear with the picture: enter image description here

 myPlot.on('plotly_click',
        function (data) {
            var point = data.points[0],
                newAnnotation = {
                    x: point.x,
                    y: point.y,
                    arrowhead: 7,
                    ax: 0,
                    ay: 80,
                    bgcolor: 'rgba(255, 255, 255, 0.85)',
                    arrowcolor: point.fullData.marker.color,
                    font: { size: 12 },
                    bordercolor: point.fullData.marker.color,
                    borderwidth: 2,
                    text:
                        ' | <b>Messung: </b> ' + vitSigTitle + '  |<br>' + '---- <br>'+
                        '<b>Zeitpunkt </b><br>' +
                        (new Date(point.x)).toLocaleString('default')+  '<br>'+
                        '<i>Jahr: </i>                  '   + (new Date(point.x)).getFullYear() + '<br>' +
                        '<i>Monat: </i>                '  + (new Date(point.x)).toLocaleString('default', { month: 'long' }) + '<br>' +
                        '<i>Tag: </i>               '  + (new Date(point.x)).toLocaleDateString('default', { weekday: 'long' }) + '<br>' +
                        '<i>Uhrzeit: </i>         '+ (new Date(point.x)).toLocaleTimeString() + '<br>' +
                        '<b>Messwert</b><br>' + (point.y) + vitSigUnit
                },
                newIndex = (node.children[0].layout.annotations || []).length;
            // delete instead if clicked twice
            if (newIndex) {
                var foundCopy = false;
                node.children[0].layout.annotations.forEach(function (ann, sameIndex) {
                    if (ann.text === newAnnotation.text) {
                        Plotly.relayout(node.children[0], 'annotations[' + sameIndex + ']', 'remove');
                        foundCopy = true;
                    }
                });
                if (foundCopy) return;
            }

As you see, "Tag" is completely offset.

Here is my code:

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda