Cannot display a tooltip label showing the two values of the two series together without also merging the label
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 18.3k
- 派生
- 2k
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 28
描述
I am attaching this script because it is too long to paste.
☠️ 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!
☠️ 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.
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从附加的 ploty v3.html 开始,使用 plotly-2.32.0 脚本引用和 const datiGrafico 数据复现其行为。根据完整规范比较 tooltip、hover、双轴、缺失值和年份标签的行为,包括 #myPlot 渲染条件。完成的标准是明确确定报告的行为中哪些属于库 bug,哪些属于不受支持的要求。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 20/100