apexcharts / vue-apexcharts

📊 Vue 2 component for ApexCharts
https://apexcharts.com
MIT License
1.34k stars 136 forks source link

Unable to apply certain styles via annotation cssClass #488

Open jsmartt opened 1 year ago

jsmartt commented 1 year ago

I'm trying to apply a class to my x-axis annotation label which contains cursor: pointer. I can successfully set the label.style.cssClass property like so:

annotations: {
  xaxis: [
    {
      x: new Date("11/17/2017").getTime(),
      label: {
        style: {
          cssClass: "pointer" // Not working as intended
        },
        text: "Styled Anno"
      }
    }
  ]
}

I see that the pointer class gets applied to a <text> tag, but only certain css styles appear to be working. font-size works, but cursor: pointer does not. I want to indicate to my users that the annotation is clickable (only for certain annotations that are clickable). Is there way to do this?

See https://codepen.io/jsmartt/pen/vYVewjB

Thanks!


Note that I was able to inspect the DOM elements and apply the class to the <rect> tag that precedes the <text> tag, and that worked.

<!-- Applying the class to this <rect> tag works: -->
<rect id="SvgjsRect1145" width="22" height="95.40625" x="66.71749877929688" y="18.34375" rx="2" ry="2" opacity="1" stroke="#775dd0" stroke-width="1" stroke-dasharray="0" fill="#775DD0"></rect>

<!-- ...but the class is applied to the <text> tag, which doesn't appear to support certain styling: -->
<text id="SvgjsText1140" class="apexcharts-text apexcharts-xaxis-annotation-label pointer " font-family="Helvetica, Arial, sans-serif" x="77.7175" y="72.046875" text-anchor="middle" dominant-baseline="auto" font-size="11px" font-weight="400" fill="#ffffff" rel="0" style="font-family: Helvetica, Arial, sans-serif;" transform="rotate(-90 77.71749877929688 67.046875)">Styled Anno</text>
github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.