JohnCoene / echarts4r

🐳 ECharts 5 for R
http://echarts4r.john-coene.com/
Other
595 stars 81 forks source link

Legend interactivity change due to tooltip formatter #457

Open ddrogen opened 2 years ago

ddrogen commented 2 years ago

Many thanks for the package! I used this example (https://github.com/JohnCoene/echarts4r/issues/4) in my line chart with 3 categories (doing bind=percentage_label), but the legend interactivity is not working. If I leave e_tooltip(trigger="axis"), I am able to un-click the legend to see the desire series, but I lose my label in percentage. Why inserting JS into the tooltip lead to that behavior?.

e_tooltip(formatter = htmlwidgets::JS("
    function(params){
      return('</strong> Year-Month: ' + params.value[0] + '<br /> RC_Rate: ' + params.name)}"), 
            textStyle=list(fontFamily="Arial", fontSize=12))

versus

e_tooltip(trigger="axis")

Thanks!