Bearcart.Chart
Generate a Rickshaw time series visualization with Pandas
Series and DataFrames.
The bearcart Chart generates the Rickshaw visualization of a Pandas
timeseries Series or DataFrame. The only required parameters are
data, width, height, and type. Colors is an optional parameter;
bearcart will default to the Rickshaw spectrum14 color palette if
none are passed. Keyword arguments can be passed to disable the
following components:
- x_axis
- y_axis
- hover
- legend
-
class bearcart.Chart(data=None, width=750, height=400, plt_type='line', colors=None, x_time=True, y_zero=False, **kwargs)
Visualize Pandas Timeseries with Rickshaw.js
-
create_chart(html_path='index.html', data_path='data.json', js_path=None, css_path=None)
Save bearcart output to HTML and JSON.
- html_path: string, default ‘index.html’
- Path for html output
- data_path: string, default ‘data.json’
- Path for data JSON output
- js_path: string, default None
- If passed, the Rickshaw javascript library will be saved to the
path. The file must be named “rickshaw.min.js”
- css_path: string, default None
- If passed, the Rickshaw css library will be saved to the
path. The file must be named “rickshaw.min.css”
HTML, JSON, JS, and CSS
- >>>vis.create_chart(html_path=’myvis.html’, data_path=’visdata.json’),
- js_path=’rickshaw.min.js’,
cs_path=’rickshaw.min.css’)
-
transform_data(data)
Transform Pandas Timeseries into JSON format
- data: DataFrame or Series
- Pandas DataFrame or Series must have datetime index
JSON to object.json_data
>>>vis.transform_data(df)
>>>vis.json_data