H17: Create chart with csv data#13
Conversation
raf18seb
left a comment
There was a problem hiding this comment.
Hi! Almost perfect, only 2 request changes - the first one here, the second one in the comments.
- The tooltip in the columnrange series is not showing the hours, see the screenshots
Not a mistake, but a small additional comment: try to avoid setting the constant max and tickInterval - letting Highcharts to calculate it automatically is usually a better choice.
max: 24 * 60,
tickInterval: 60,| labels: { | ||
| formatter() { | ||
| return this.value + '°' + T_UNITS[currentTUnit]; | ||
| } | ||
| } |
There was a problem hiding this comment.
- Whenever you can, use
formatinstead offormatter(better e.g. for JSON configs)
labels: {
format: `{value}°${T_UNITS[currentTUnit]}`
},There was a problem hiding this comment.
Format will not work here because when you press the button: currentTUnit variable changes and axis text must change as well.
There was a problem hiding this comment.
Then perhaps you should update the yAxis.labels.format on a button click as well? Only a few lines of additional code, but it'll work for more specific cases.
You don't have to change it now, but please keep it in mind - format is usually better than formatter. We had many users on support with problems when the formatter wasn't working in specific cases, e.g. when the chart config had to be a JSON string (no functions, only strings).
Soon you'll work with Highcharts core code, and build API and documentation, and you'll have to use format only.
ps. I can see the .attr() on the yAxis text - using yAxis.update({ title: { text: ... } }) is also better because you store all real values on the chart (with .attr, you only change DOM)
There was a problem hiding this comment.
Okay. I'll keep that in mind.
No description provided.