Skip to content

Latest commit

 

History

History
47 lines (28 loc) · 1.29 KB

Challenges.md

File metadata and controls

47 lines (28 loc) · 1.29 KB

02 Charts / 02 BarChart

  1. Add a padding between each of the chart bars.

No padding Bar Padding

  1. What about adding some color to each bar, based on the product Id ?

Some tips:

  • We can treat product category as an ordinal.

  • We can create a function that returns a color based on an existing d3 SchemeCategory

// helper that returns a color based on an ID
var barColor = d3.scaleOrdinal(d3.schemeCategory10);

The React it self has an attribute called filled, we can attach to it a function(d) extract from it the current product and invoke the color function we have previously created.

  1. Let's rotate 90º the bar chart, we want it to show it like:

Vertical

If you need some help, a similar sample can be found:

Blocks Sample

02 Charts / 05 Lines

  1. Add one more line to the chart, this line will represent a set of expenses.

TwoLines

02 Charts / 06 Pie

  1. Create a Doughnut like chart.

Doughnut

  1. Make the pie chart scale and take all the available canvas space, plus include margin for legend.