plotly / plotly/plotly.js

Cannot display a tooltip label showing the two values of the two series together without also merging the label

オープン
#7,547 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

feature P3
主要言語
JavaScript
スター
18.3k
フォーク
2k
平均マージ
2日 12時間
マージ済み PR(30日)
28

説明

I am attaching this script because it is too long to paste.

ploty v3.html

☠️ To begin with, I had to add the reference to <script src="https://cdn.plot.ly/plotly-2.32.0.min.js?v=6"></script> because plotly-latest.min does not seem to be up to date.

☠️ I tried using a translation library, but it keeps formatting dates in English. And I had to write a function.

☠️ The plot must display the two y-axes consistently: if I zoom on one, it must also apply to the other; if I move one, the other must also move, so that the plots always have the same scale and are superimposed. Instead, I had to resort to locking the zoom! X works correctly, however.

☠️ I have come to the conclusion that either it creates a label for each point, or it creates a single tooltip label for all elements of that year. So it is not possible to create a tooltip that shows data on two y-series and another tooltip that shows only the year (x) when data is missing. If it creates the year, it puts it on all labels, even where there is data!

Image Good, although I would prefer it without the dotted line, which also has more thickness. It must show the year, even if perhaps with better graphics. Perhaps higher up, so as not to cover the year separation dots. Image If there are already values for that year, the year should not be displayed: it is redundant. However, **it does not seem possible to display a tooltip label showing the two values of the two series together without also merging the label.** And it's also the wrong year.

☠️ It doesn't display the values correctly at the end, and the hover effect disappears when the mouse is over the last star. In fact, the values displayed are incorrect.

Image
Complete specification of what I want to achieve

const datiGrafico must contain the values to be displayed. If a value is missing, it is indicated by null. Dates are always present, otherwise the purpose is lost.

KEY POINTS:
  • The left Y-axis must show costs in red, the right Y-axis must show kilometers in blue, and both must show whole numbers and a vertical axis legend.
  • Above, there must be a legend indicating the meaning of the colors, even if redundant, or elsewhere.
  • The two Y axes must move congruently: when one is moved or zoomed, the other must act accordingly, so that they remain superimposed. | Removed because it is not possible.
  • The graph must show segments and a marker at the position of the points.
  • The graph must show an error symbol if data is missing. If it is between valued dates, it will show a dotted line connecting the valid values. The symbol's tooltip must indicate which parameter is missing, or both if applicable. Currently, it is halfway up.
  • The graph must show labels on the graph with dates in Italian (this required a method that I deeply dislike, because the library itself should do this).
  • The horizontal lines must be equidistant from each other, the values at the extremes must be aligned; the two graphs must be aligned on X and Y. In other words, each horizontal axis must have a label on the right and one on the left
  • The Y axes show the level values of the horizontal lines, which must be at a constant height and not those of the values. Otherwise, they would not be aligned.
  • There should be no negative values, so the zero of both Y axes must correspond to the X axis. Any negative values will be drawn above the year labels. [This last part is to be done... perhaps, currently the negative parts are cut off].
  • Along the X axis
    • the years must be shown as horizontal text, from oldest to newest
    • the year label must be centered text, halfway through the year (July 1), indicated by a mark longer than the dots; the mark (arrow) indicates July 1
    • At the point where the graph area moves from one year to the next, there must be a separating dot (January 1), but without a label.
    • Currently, the year labels are below the dots and arrows, but this is a huge task. It is actually a documentation problem: after a while, I found a decent solution. Previously, the years were at the same height as the dots, but the start and end information for that year was lost
    • The years with labels should not be those of the data, but should start with the first year of the first value and end with the last year of the last value (or slightly beyond), but in between there must be all possible years. The time must have a constant width. And this is not respected: the last year indicated is before the last value.
    • The labels on the years must not have decimals. As incredible as it may seem, this was one of the problems.
  • Moving the mouse over the graph should bring up a semi-transparent yellow rectangle highlighting the area occupied by the year on which the mouse is positioned.
  • If the data is there, then the div #myPlot graph is drawn after emptying it. Otherwise, the existing placeholder is left in place.

I removed the Autoscale button from the graph, as it only causes problems: the horizontal lines no longer coincide.

FURTHERMORE
  • In order to place the year labels where I want and display useful information such as labels, I have to hide the real ones, thus creating endless series of data.

This is both a request for help (in the very rare event that it can be done) and a report of bugs and library shortcomings.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

添付された ploty v3.html から始め、plotly-2.32.0 のスクリプト参照と const datiGrafico データを使用して動作を再現してください。#myPlot のレンダリング条件を含む完全な仕様に照らして、tooltip、hover、二重軸、欠損値、年ラベルの動作を比較してください。報告された動作のうち、どれがライブラリのバグで、どれがサポートされていない要件なのかを明確に判定できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
data-visualization
issue の種類
バグ
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
20/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。