globeandmail / chart-tool

A responsive charting application
http://globeandmail.github.io/chart-tool
MIT License
249 stars 35 forks source link

Error: <text> attribute y: Expected length, "NaN" #227

Open abrambailey opened 4 years ago

abrambailey commented 4 years ago

I'm having this issue:

image

I had the same issue with the older version, but just installed to 1.4.2 and same issue. It leads to console errors anywhere I embed the chart, and even seeing the console errors inside of the chart builder interface itself.

tomcardoso commented 4 years ago

Thanks @abrambailey. Can you send me the data you're using? Want to try and replicate this. No idea what specifically is causing this… seems it could be the tooltips based on the element.

abrambailey commented 4 years ago

Here's the data:

<!-- CHART TOOL v1.4.2-0 -->
<!-- edited: Tue Jun 02 2020 13:46:02 GMT-0500 (Central Daylight Time) -->
<!-- slug: Test123 -->
<div class="ct-chart" data-chartid="ct-xrsZ9KGvvXJC3w2Rn">
  <script type="text/javascript">
    (function(root) {
      var data = {
  "version": "1.4.2",
  "id": "xrsZ9KGvvXJC3w2Rn",
  "heading": "",
  "qualifier": "",
  "source": "HEARING TRACKER",
  "tags": [],
  "chart": {
    "class": "primary",
    "hasHours": false,
    "data": "type, number\na,1\nb,2\nc,3",
    "options": {
      "annotations": true,
      "expanded": false,
      "footer": true,
      "head": true,
      "indexed": false,
      "interpolation": false,
      "legend": true,
      "qualifier": true,
      "share_data": true,
      "stacked": false,
      "tips": true,
      "type": "bar",
      "x_axis": true,
      "y_axis": true
    },
    "x_axis": {
      "display": true,
      "scale": "linear",
      "ticks": "auto",
      "orient": "bottom",
      "format": "comma",
      "nice": false
    },
    "y_axis": {
      "display": true,
      "scale": "ordinal",
      "ticks": "auto",
      "orient": "right",
      "format": "comma",
      "nice": false
    },
    "annotations": {
      "highlight": [],
      "range": [],
      "text": [],
      "pointer": []
    }
  }
};
      root.ChartTool = root.ChartTool || [];
      root.ChartTool.push({id: "ct-" + data.id, data: data});
      var b = document.getElementsByTagName("body")[0];
      if (!b.classList.contains("ct-charttool-init")) {
        b.classList.add("ct-charttool-init");
        var c = document.createElement("link");
        var j = document.createElement("script");
        c.href = "https://charts.hearingtracker.com/1.4.2/chart-tool.min.css?token=0"; c.rel = "stylesheet";
        j.src = "https://charts.hearingtracker.com/1.4.2/chart-tool.min.js?token=0"; j.async = true; j.defer = true;
        document.getElementsByTagName("head")[0].appendChild(c);
        document.getElementsByTagName("head")[0].appendChild(j);
      }
    })(this);
  </script>
</div>
tomcardoso commented 4 years ago

Odd, I can't replicate this. Can you try this while running the master branch in development?