

When explaining the differences between D3.js and Chart.js, I often use the analogy of comparing Apple and Android products. What level of customization are you hoping to achieve? Since both have good, varied options, the coder must choose what format they think will make their data the easiest to interpret.ģ. It’s up to the creator to decide what types of graphs they want to show. Adding any of these to one’s project will surely make it stand out from the crowd. Some that aren’t included in Chart.js include the types: violin, boxplot, ridgeline, heatmap, correlogram, bubble, density (2D), wordcloud, lollipop, treemap, dendrogram, maps, sankey, and edge bundling, just to name a few. In contrast, D3.js lets its coders create seven different categories of graphs, with about five or more specific graph types in each. Even though Chart.js can suggest many options, it definitely doesn’t cover them all. What sort of graph do you wish to produce?Ĭhart.js offers its users the popular graph types of bar, line, area, scatter, radar, and pie, a nice breadth of options for most simple data visualization projects. It took my capstone team and I around two weeks to learn how rendering a bubble map graph in D3.js works, so beginners beware if this package is one you’re considering.Ģ. This was a major part of what added to the time of producing graphs because of D3.js’s steep learning curve. This was my Capstone team’s way of separating what D3.js would control and what React would control, as they both want to take over the DOM. In these hooks, first was called a function that would dispatch our data from Redux, then another hook with a function to initialize the chart, to which the later chart parts would be added in another function, inside the React render function. To use it within React, special hooks like “useEffect” were required and were new to me. My learning experience with D3.js was not nearly as short or as friendly as it was with Chart.js. This was very convenient considering I only had four days to learn a new technology, that being Chart.js, and using it in a freshly created web application. Instantly upon rendering the page, I was shown my horizontal bar chart with colors, labels, animations, a legend, and hover interactivity. After I found what I needed in the documentation, I simply imported the needed “Horizontal Bar” component, copied it into my React render function and inserted all my data and color changes into the correct fields. I used both Chart.js and D3.js in the React JavaScript framework and I must admit that Chart.js was nothing but a breeze in comparison. To use the graphs found in this package, all the coder needs to do is go to the documentation, find the type of graph that will show off their obtained data the best, and copy it into their HTML or a React render function. In my experience, if you desire a more basic type of graph and need it done in a short amount of time Chart.js is for you. How much time is available for you to work on this project?.Questions to ask yourself when deciding which to use:
