Overview
Easy JavaScript based charts in any web application
Last updated
Easy JavaScript based charts in any web application
Last updated
ChartSQL.js is currently in development. Documentation is for feedback purposes.
ChartSQL.js is an open source library to chart SQL (or any table like data) seamlessly within any web application.
We have designed ChartSQL.js to be the easiest to use JavaScript charting library available.
Simple .js integration
Supports any SQL table-like or NoSQL source of data
Full rendering control with intuitive 'directives'
What You Query is What You Chart (Whikee-Whic) - Simple and declarative charting.
The following is all that is required to create a basic column chart
Add chartsql.js
to Your Project and setup a basic column chart
createChart()
allows you to render data into chart visuals at the target HTML element
The typical flow is:
Setup ChartSQL
Fetch data
call createChart()
to render the data into a chart.
ChartSQL.js will try to automatically choose a basic chart type depending on the fields in your data.
The auto charts helps you quickly visualize and explore data and then you can Customize Charts for more control.
When there is one string and one numeric field in the data
When there is one string and 2 or more numeric fields the numeric fields will be grouped
When there is a date field and a numeric field
You can specify exactly how to render the chart with directives (aka @directives).
Directives allow you to fully control the type of chart and the selection of the categories, series formats and other ChartSQL.js features.
createChart()
takes a 'directives' object which contains the directives for controlling rendering of the chart.
chart - The type of chart: bar, column, line etc
category - The column to use for the category (primary axis) of the chart
series - The column/s to use for the data (secondary axis) of the chart
formats - The data formats to render for the series
You can See All Directives for all the ways in which you can customize your charts.
ChartSQL.js is currently in development and does not support all directives. See the Supported Directives section for current support
ChartSQL's namesake comes from the fact that you can define your chart directives within SQL source code. The same capability is provided to you in ChartSQL.js.
If your data is already coming from an executed SQL script, you can also choose to define your directives in your SQL.
You pass the full SQL script to createChart directives and it will get parsed
ChartSQL.js is designed to work with table like data of columns and rows. Typically this data will come from executing a SQL query, but data from any source can be charted.
The createChart()
method liberally accepts table data in a few different formats.
The first row in the array should be the column names
If desired, you can instantiate your own instance of the Data.js class that ChartSQL creates internally.
ChartSQL.js is the parsing and rendering layer. It does not handle managing and executing SQL against datasources, creating dashboards, or editing SQL Charts.
ChartSQL.js is a subset of ChartSQL Studio and Dashboard Features. See the tables below of supported features
✔️ = fully supported
❌ = no support planned
☐ = support planned
〰️ = Partial support
List of Auto Charts charts that are currently supported
List of Chart Types that are currently supported
Parameter | Required? | Description |
---|---|---|
Auto Chart | ChartSQL.js | ChartSQL Studio |
---|---|---|
Type | ChartSQL.js | ChartSQL Studio |
---|---|---|
Directive | ChartSQL.js | ChartSQL Studio | Note |
---|---|---|---|
Capability | ChartSQL.js | ChartSQL Studio | Note |
---|---|---|---|
target
no
The DOM element ID where the chart will be rendered.
data
yes
An object containing the data to be used for rendering the chart. See Working with Data
directives
yes
SQL string containing directives, or object of directives.
Column
✔️
✔️
Grouped Column
✔️
✔️
Date-based Line
✔️
✔️
Datetime based line
✔️
✔️
Stacked-Grouped Column
☐
✔️
Scatter
✔️
✔️
Bubble (scatter with size)
☐
✔️
Heatmap
☐
✔️
Area
☐
✔️
Bar
☐
✔️
Bubble
☐
✔️
Column
☐
✔️
Combo
☐
✔️
Gauge
☐
✔️
Heatmap
☐
✔️
Line
☐
✔️
Pie
☐
✔️
Radar
☐
✔️
Scatter
☐
✔️
@baselines
☐
✔️
@baseline-types
☐
✔️
@chart
✔️
✔️
@cateogry
✔️
✔️
@formats
☐
✔️
@secondary-series
☐
✔️
@series
✔️
✔️
@title
☐
✔️
@subtitle
☐
✔️
@groups
☐
✔️
@series-types
☐
✔️
@series-labels
☐
✔️
@stacking-mode
☐
✔️
@dash-id
❌
✔️
Only used for publishing to ChartSQL cloud. No use for ChartSQL.js
@overlay-series
☐
✔️
@tags
❌
✔️
Used for searching inside ChartSQL Studio and dashboards. Not used by ChartSQL.js
@mongodb-query
❌
✔️
Only used by ChartSQL Studio
Series Assist
✔️
✔️
Assists when selecting series and no @series is defined
Category Assist
✔️
✔️
Assists in selecting categories when no @category is defined