question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

radar || polarArea chart -TypeError: Cannot set property 'backdropColor' of undefined

See original GitHub issue

Expected Behavior

There should be a backgroundColor /backdropColor Chart.default property for the scale/ticks options.

Current Behavior

I can change the font color with fontColor only but not the background.

Chart.defaults.ticks.backgroundColor = 'transparent'
Chart.defaults.ticks.backdropColor = 'transparent'

Error:

Render Graph Error on polarArea :  TypeError: Cannot set property 'backgroundColor' of undefined
Render Graph Error on radar :  TypeError: Cannot set property 'backgroundColor' of undefined
Render Graph Error on radar :  TypeError: Cannot set property 'backdropColor' of undefined

I am trying to display a radar || polarArea chart on a page with a dark background.

Thank you!

Possible Solution

I’m looking for a way to set the background color via the global.default settings for the ticks in radar and polarArea. You can use the options, but I would always have to do this explicitly for all displays. It would be easier for me if I could do this with the global settings.

Environment

  • Chart.js version: “chart.js”: “^2.9.4”
  • Browser name and version: Chrome Version 86.0.4240.80 (Offizieller Build) (x86_64)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:24 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
zibouscommented, Oct 30, 2020

@etimberg

Inside the shadowroot, I would make sure that there’s a div before the canvas. The sizing goes really bad when inside the shadowroot directly.

Yes there is a div before the canvas

<ha-card id="card-cjv4hls21" class="type-custom-chart-card">
    <div class="card-header" style="padding-bottom: 0px !important;">
           <ha-icon icon="mdi:nutrition" style="position: relative; top: -4px; padding: 0px 12px 0px 4px;"></ha-icon>
           <span><!---->Makro Nährstoffe<!----></span>
    </div>
    <div id="content-cjv4hls21" style="height: 240px; width: 100%;">
          <canvas id="chart-cjv4hls21" height="240" width="352" 
                        style="user-select: none; display: block; 
                        box-sizing: border-box; width: 352px; height: 240px;">
          </canvas>
    </div>
</ha-card>
0reactions
kurklecommented, Nov 19, 2020

Closing in favor of #8056

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot set property 'backgroundColor' of undefined
To answer my own question,. Javascript has reserved words which cannot be used these reserved words as variables, labels, or function names.
Read more >
Polar Area Chart - Chart.js
Polar area charts are similar to pie charts, but each segment has the same angle - the radius of the segment differs depending...
Read more >
Getting Started With Chart.js: Axes and Scales - Code Tutsplus
For example, if you see a plot of car speed and can't figure out the unit ... This scale type is used for...
Read more >
search_plus_index.json - UNPKG - chart.js
some properties may be undefined so be sure to test any context property ... types: line bar radar polar area doughnut and pie...
Read more >
Chart.js issue #6188 fixed (with title) - CodePen
(c) 2019 Chart.js Contributors. 15. * Released under the MIT License. 16. */. 17 !function(t,e){"object"==typeof exports&&"undefined"!=typeof ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found