Skip to content

Tag: javascript

Remove padding from chartjs bar chart canvas

I want to create a single stacked bar chart with Chart.js that shows how close someone is to a certain amount of money. To define this amount I put a dotted line on top of the chart. The problem is however that the canvas of this chart has some unwanted padding. So the line spills over outside of the chart.

JavaScript: Filter object, keeping unique properties

I have an object that I need to filter against and return a new object. The goal is to get all ids that contain “A” in val, BUT only include ids with a unique val. Below is what I’m currently doing, but I wonder if there’s a more efficient way to do this. As can be seen when you run