Timeseries Plots
Timeseries plot are based on date index
Examples
In the example below, we plot the yearly trend of a financial dataset. First, we reset the index to the Date column.
import { useEffect } from 'react';
import './App.css';
import { readCSV } from "danfojs-nightly";
function App() {
useEffect(() => {
readCSV(
"https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv"
)
.then((df) => {
const layout = {
title: "A financial charts",
xaxis: {
title: "Date",
},
yaxis: {
title: "Count",
},
};
const config = {
columns: ["AAPL.Open", "AAPL.High"],
};
const new_df = df.setIndex({ column: "Date" });
new_df.plot("plot_div").line({ config, layout });
})
.catch((err) => {
console.log(err);
});
}, [])
return (
<div className="App">
<header className="App-header">
<div id="plot_div"></div>
</header>
</div>
);
}
export default App;

Last updated
Was this helpful?