GithubHelp home page GithubHelp logo

Comments (6)

sgratzl avatar sgratzl commented on August 25, 2024

can you provide a standalone example that I can use.

from chartjs-chart-geo.

MrsNickalo avatar MrsNickalo commented on August 25, 2024

Will this work? This just creates an empty bubbleMap:
createEmptyChart() { // we must destroy the existing chart before making a new one if(this.chart) { this.chart.destroy(); this.chart = null as any; } this.chart = new Chart("MyChart", { type: 'bubbleMap', data: { datasets: [{ outline: this.states, outlineBackgroundColor: '#EAEAEA', outlineBorderColor: 'black', outlineBorderWidth: 1, showOutline: true, borderWidth: 1, borderColor: 'black', backgroundColor: '#990000', data: [], }] }, options: { plugins: { legend: { display: false }, }, scales: { projection: { axis: 'x', projection: 'albersUsa', }, size: { axis: 'x', display: false } } } }); }

from chartjs-chart-geo.

sgratzl avatar sgratzl commented on August 25, 2024

I cannot reproduce it https://codepen.io/sgratzl/pen/BaedJmz?editors=0010

from chartjs-chart-geo.

MrsNickalo avatar MrsNickalo commented on August 25, 2024

My application is an Angular application using Typescript. As such, I'm not referencing the HTML element like you are. In your Codepen, I see this:
let elem = document.getElementById("canvas");
And you pass that into the new Chart call:
const createChart = (elem) => { return new Chart(elem,
In my application, I am simply referencing the HTML element by its id in the call to new Chart:
this.chart = new Chart("MyChart",
and in my HTML:
image

I tried to set up a Codepen to demonstrate but was unable to get the TS and Angular stuff to work. Could the issue be that I am referencing the HTML element by id instead of getting the HTML element like you do?
And if that is the issue, why do I only encounter the error with "bubbleMap" and not with "choropleth"?

from chartjs-chart-geo.

MrsNickalo avatar MrsNickalo commented on August 25, 2024

Actually, I don't think that's it because even doing it this way:
image

I still get the same error:
image

from chartjs-chart-geo.

MrsNickalo avatar MrsNickalo commented on August 25, 2024

By moving the elem variable out and making it a component variable, it appears to be working now. Thanks for the assistance.

from chartjs-chart-geo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.