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.

QUESTION: is it possible to draw two backgroundColors in an area chart using the same dataset?

See original GitHub issue

desire depth chart image

current chart image

datasets: [
          {
            backgroundColor: props => {
              if (props.dataIndex > 100) {
                return 'rgb(255, 99, 132)';
              } else {
                return 'rgb(75, 192, 192)';
              }
            },
            borderColor: props => {
              if (props.dataIndex > 100) {
                return 'rgb(255, 99, 132)';
              } else {
                return 'rgb(75, 192, 192)';
              }
            },

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
benmccanncommented, Nov 22, 2019

See these docs: https://www.chartjs.org/docs/latest/general/options.html#scriptable-options

You should probably be able to pass a function for the color and background color that accomplishes this

0reactions
topoint2019commented, Nov 22, 2019

pointRadius: 0 does the trick

Read more comments on GitHub >

github_iconTop Results From Across the Web

Draw two plots using chartjs over one another with transparency
You need to set fill property to false for the first dataset (the red one), to make it transparent. datasets: [{ label: "Consumption",...
Read more >
Visualization: Area Chart - Google Developers
An object with members to configure the placement and size of the chart area (where the chart itself is drawn, excluding axis and...
Read more >
Size and Lay Out Your Dashboard - Tableau Help
Use this setting when you're designing for two different display sizes that need the same content and have similar shapes—such as small- and...
Read more >
backgroundColor - Sets the Background Color of Chart
Hi all,. is there a way to use a background image instead of background colours? Cheers. Sunil Urs says:.
Read more >
Fill Under or Between Series in an Excel XY Chart - Peltier Tech
To fill under or between XY series, we'll make use of this same approach: XY data on ... We will also need two...
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