Data
All charts require data. F2 charts require data to be an array of objects, just like this:
const data = [
{ year: 2010, sales: 40 },
{ year: 2011, sales: 30 },
{ year: 2012, sales: 50 },
{ year: 2013, sales: 60 },
{ year: 2014, sales: 70 },
{ year: 2015, sales: 80 },
{ year: 2016, sales: 80 },
{ year: 2017, sales: 90 },
{ year: 2018, sales: 120 }
];After instantiate chart, pass in the data by:
chart.source(data);When data changes, call the following method:
chart.changeData(data); Data for some charts
Pie Chart
If you want to draw a pie chart, there should be a constant field in data, just like the a field in the following dataset:
See pie chart demo.
Column Range Chart
If you want to draw a column range chart, the y axis' data should be an array type, just like y field in the following data:
See column range chart demo.
Candlestick Chart
If you want to draw a candlestick chart, the y axis' data should be an array type, just like range field in the following data:
See candlestick chart demo.
Last updated