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.

Chart 3.0.0-beta.7: bar borderRadius - bottomRight & bottomLeft ??

See original GitHub issue

Expected Behavior

Am I doing something wrong or is it not possible? The topLeft and topRight settings work perfectly. How can I use pointStyle on a barchart?

Example: Bildschirmfoto 2020-12-07 um 15 43 08

Current Behavior

The bottomLeft and bottomRight do not work for me --> borderSkipped: false

Possible Solution

???

Steps to Reproduce

see: https://jsfiddle.net/zibous/57Lwhcdx/

Context

var data = {
  labels: ['Current', 'Today', 'Month', 'Year'],
  datasets: [{
      label: 'Water Consumtion 2020',
      backgroundColor: ['#2980b9', '#2980b9', '#2980b9', '#2980b9'],
      borderWidth: 0,
      data: [15, 150, 1500, 6000],
      unit: 'liter',
      borderRadius: {
        // topLeft: 100,
        // topRight: 100,
        bottomRight: 100,   <--- Do not work
        bottomLeft: 100,      <--- Do not work
      }
    },
    {
      borderWidth: 0,
      tooltip: false,
      data: [9985, 9850, 8500, 4000],
      showLine: false,
      pointRadius: 8,
      pointStyle: ['▲', '▼', '≃', '▲']    <---  possible or workaround ???
    }
  ]

};
var options = {
  type: 'bar',
  data: data,
  options: {
    responsive: true,
    maintainAspectRatio: false,
    scales: {
      x: {
        stacked: true,
        ticks: {
          major: {
            enabled: true,
          },
        },
      },
      y: {
        stacked: true,
        ticks: {
          major: {
            enabled: true,
          },
        },
      }
    },
    plugins: {
      legend: {
        display: false,
      },
      title: {
        display: true,
        text: 'Consumption of water 2020'
      },
      tooltip: {
        callbacks: {
          label: (chart) => {
            if (chart.dataset.tooltip === false) {
              return null;
            }
            return chart.formattedValue + " " + chart.dataset.unit || "";
          }
        }
      },
    },
  }
};

window.onload = function() {
  // global
  Chart.defaults.responsive = true;
  Chart.defaults.maintainAspectRatio = false;
  Chart.defaults.animation = false;
  Chart.defaults.locale = "de-AT";
  // default font and -color
  Chart.defaults.font.family = "Roboto, Quicksand,'Open Sans','Rubik','Helvetica Neue', 'Helvetica', 'Arial', sans-serif";
  Chart.defaults.color = '#FFFFFF';
  Chart.defaults.font.size = 14;
  // title settings
  Chart.defaults.plugins.title.font.size = 20
  Chart.defaults.plugins.title.font.style = "normal";
  // gridlines
  Chart.defaults.scale.gridLines.display = false
  Chart.defaults.scale.display = false;
  // tooltips
  Chart.defaults.plugins.tooltip.enabled = true;
  Chart.defaults.plugins.tooltip.backgroundColor = "#ecf0f1";
  Chart.defaults.plugins.tooltip.titleColor = "#2c3e50"
  Chart.defaults.plugins.tooltip.bodyColor = "#607D8B"
  Chart.defaults.plugins.tooltip.footerColor = "#34495e"
  // create the chart
  var ctx = document.getElementById('mybar').getContext('2d');
  window.myBar = new Chart(ctx, options);
};

Environment

  • Chart.js version: Chart 3.0.0-beta.7
  • Browser name and version: any

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
LeeLenaleeecommented, Dec 7, 2020

A barchart doesnt use the point element, if you want to use it you have to create you’re own chart https://www.chartjs.org/docs/master/developers/charts

0reactions
zibouscommented, Dec 9, 2020

@danmana Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bar Chart Border Radius | Chart.js
Bar Chart Border Radius ... const config = { type: 'bar', data: data, options: { responsive: true, plugins: { legend: { position: 'top',...
Read more >
salesforce-ux/design-system/ui.component-tokens.json
... .slds-builder-header__item-action:focus"],"sassTokenName":"$color-gray-7" ... :["border-bottom-left-radius","border-bottom-right-radius","border-radius" ...
Read more >
Stacked bar chart with rounded corner of bar using Chart.js ...
Coding example for the question Stacked bar chart with rounded corner of bar using ... Corner points, from bottom-left to bottom-right clockwise //...
Read more >
border-radius - CSS: Cascading Style Sheets - MDN Web Docs
The border-radius CSS property rounds the corners of an element's outer ... bottom-right | bottom-left */ border-radius: 1px 0 3px 4px; ...
Read more >
React Charts - Simple, immersive & interactive charts for React
Succinct & Declarative. Time is short for front-end developers as it is, so having a charting system that is great out of the...
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