pablrod / p5-Chart-Plotly

Generate html/javascript charts with perl data using javascript library Plotly.js
MIT License
9 stars 4 forks source link

type constraint of trace hoverinfo #12

Closed iynehz closed 5 years ago

iynehz commented 5 years ago

Now it's Maybe[ArrayRef], for example see https://metacpan.org/source/PABLROD/Chart-Plotly-0.021/lib/Chart/Plotly/Trace/Scatter.pm#L116, and when I tried it I found it would require me to specify a arrayref of same length as the number of data points. That is in fact not necessary. According to examples in https://plot.ly/r/hover-text-and-formatting/, hoverinfo should be able to get a plain string.

pablrod commented 5 years ago

Yep! I can see this on the schema:

$ cat dist/plot-schema.json | jq .traces.scatter.attributes.hoverinfo
{
  "valType": "flaglist",
  "role": "info",
  "flags": [
    "x",
    "y",
    "z",
    "text",
    "name"
  ],
  "extras": [
    "all",
    "none",
    "skip"
  ],
  "arrayOk": true,
  "dflt": "all",
  "editType": "none",
  "description": "Determines which trace information appear on hover. If `none` or `skip` are set, no information is displayed upon hovering. But, if `none` is set, click and hover events are still fired."
}

The problem is that when arrayOk is true the rest of the schema is not checked. Every hoverinfo attribute has this problem!. I'm going to fix it!

Thanks for reporting this!!

pablrod commented 5 years ago

With the release v0.022 this should be fixed. I'm closing the issue based on absence of bug reports.