Middle
What libraries for data visualization have you worked with?
sobes.tech AI
Answer from AI
I have worked with several libraries for data visualization on the frontend:
- D3.js — a powerful library for creating interactive and custom charts and diagrams.
- Chart.js — a simple-to-use library for standard charts (line, bar, pie).
- Recharts — a React-based library built on D3, convenient for integration into React applications.
For example, with Chart.js, you can quickly create a line chart:
const ctx = document.getElementById('myChart').getContext('2d');
const myChart = new Chart(ctx, {
type: 'line',
data: {
labels: ['Jan', 'Feb', 'Mar', 'Apr'],
datasets: [{
label: 'Sales',
data: [10, 20, 15, 30],
borderColor: 'rgba(75, 192, 192, 1)',
fill: false
}]
}
});