C3 is JavaScript library which builds on top of D3. D3 is also JavaScript library used to make complex visualisations. D3 is too advanced, often we just want to add a simple graph to a webpage to show some statistics.

C3 allows us to do that without knowing all the complexity of D3 by wrapping up into a simple API. C3 provides a variety of APIs and callbacks to access the state of the chart. By using them, you can update the chart even after it’s rendered.

Below is demo of how to create simple chart in C3.

To set a C3 to your webpage you need three things:

  • D3 JavaScript file
  • C3 JavaScript file
  • C3 stylesheet file

You can choose solution to link to external services which host these files for you.


<!-- These belongs to the HTML file where you want C3 to work - put these lines into your <head> tag -->

<script type="text/javascript"src="//cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.js"></script>

<script type="text/javascript"src="//cdnjs.cloudflare.com/ajax/libs/c3/0.1.29/c3.js"></script>

<linkhref="//cdnjs.cloudflare.com/ajax/libs/c3/0.1.29/c3.css"rel="stylesheet"type="text/css">

Now we need to choose an element in our HTML page to which the chart will bind. It only means that we will specify, where we want the chart to be displayed. We can do this by adding an ID called chart. The element can be empty as well as it can contain other things, it does not even need to be a div.

<divid="chart"></div>

Then comes the actual code of chart.  Below I have shown the code for generating line chart.


var chart = c3.generate({

bindto: '#chart',

data: {

columns: [

['data1', 30, 200, 100, 400, 150, 250],

['data2', 50, 20, 10, 40, 15, 25]

],

type: 'line'    //if the type of chart is not mentioned then by default it will generate line chart.

}

});

Then, you will see the chart:

line

 

There are several options to customize the chart and you can see them below:

Additional Axis


var chart = c3.generate({

bindto: '#chart',

data: {

columns: [

['data1', 30, 200, 100, 400, 150, 250],

['data2', 50, 20, 10, 40, 15, 25]

],

axes: {

data2: 'y2'// ADD

}

},

axis: {

y2: {

show: true// ADD

}

}

});

Then, the chart will be like this:

Untitled

Show axis Label

var chart = c3.generate({

bindto: '#chart',

data: {

columns: [

['data1', 30, 200, 100, 400, 150, 250],

['data2', 50, 20, 10, 40, 15, 25]

],

axes: {

data2: 'y2'

}

},

axis: {

y: {

label: { // ADD

text: 'Y Label',

position: 'outer-middle'

}

},

y2: {

show: true,

label: { // ADD

text: 'Y2 Label',

position: 'outer-middle'

}

}

}

});

Then, the chart will be like this:

1

Change chart type

var chart = c3.generate({

bindto: '#chart',

data: {

columns: [

['data1', 30, 200, 100, 400, 150, 250],

['data2', 50, 20, 10, 40, 15, 25]

],

axes: {

data2: 'y2'

},

types: {

data2: 'bar'// ADD

}

},

axis: {

y: {

label: {

text: 'Y Label',

position: 'outer-middle'

}

},

y2: {

show: true,

label: {

text: 'Y2 Label',

position: 'outer-middle'

}

}

}

});

Then, the chart will be like this:

2

We can use APIs to load data, unload data, show/hide data

Leave a Reply

Helical Insight’s self-service capabilities is one to reckon with. It allows you to simply drag and drop columns, add filters, apply aggregate functions if required, and create reports and dashboards on the fly. For advanced users, the self-service component has ability to add javascript, HTML, HTML5, CSS, CSS3 and AJAX. These customizations allow you to create dynamic reports and dashboards. You can also add new charts inside the self-service component, add new kind of aggregate functions and customize it using our APIs.
Helical Insight’s self-service capabilities is one to reckon with. It allows you to simply drag and drop columns, add filters, apply aggregate functions if required, and create reports and dashboards on the fly. For advanced users, the self-service component has ability to add javascript, HTML, HTML5, CSS, CSS3 and AJAX. These customizations allow you to create dynamic reports and dashboards. You can also add new charts inside the self-service component, add new kind of aggregate functions and customize it using our APIs.
Helical Insight, via simple browser based interface of Canned Reporting module, also allows to create pixel perfect printer friendly document kind of reports also like Invoice, P&L Statement, Balance sheet etc.
Helical Insight, via simple browser based interface of Canned Reporting module, also allows to create pixel perfect printer friendly document kind of reports also like Invoice, P&L Statement, Balance sheet etc.
If you have a product, built on any platform like Dot Net or Java or PHP or Ruby, you can easily embed Helical Insight within it using iFrames or webservices, for quick value add through instant visualization of data.
If you have a product, built on any platform like Dot Net or Java or PHP or Ruby, you can easily embed Helical Insight within it using iFrames or webservices, for quick value add through instant visualization of data.
Being a 100% browser-based BI tool, you can connect with your database and analyse across any location and device. There is no need to download or install heavy memory-consuming developer tools – All you need is a Browser application! We are battle-tested on most of the commonly used browsers.
Being a 100% browser-based BI tool, you can connect with your database and analyse across any location and device. There is no need to download or install heavy memory-consuming developer tools – All you need is a Browser application! We are battle-tested on most of the commonly used browsers.
We have organization level security where the Superadmin can create, delete and modify roles. Dashboards and reports can be added to that organization. This ensures multitenancy.
We have organization level security where the Superadmin can create, delete and modify roles. Dashboards and reports can be added to that organization. This ensures multitenancy.
We have organization level security where the Superadmin can create, delete and modify roles. Dashboards and reports can be added to that organization. This ensures multitenancy.
We have organization level security where the Superadmin can create, delete and modify roles. Dashboards and reports can be added to that organization. This ensures multitenancy.
A first-of-its-kind Open-Source BI framework, Helical Insight is completely API-driven. This allows you to add functionalities, including but not limited to adding a new exporting type, new datasource type, core functionality expansion, new charting in adhoc etc., at any place whenever you wish, using your own in-house developers.
A first-of-its-kind Open-Source BI framework, Helical Insight is completely API-driven. This allows you to add functionalities, including but not limited to adding a new exporting type, new datasource type, core functionality expansion, new charting in adhoc etc., at any place whenever you wish, using your own in-house developers.
It handles huge volumes of data effectively. Caching, Pagination, Load-Balancing and In-Memory not only provides you with amazing experience, but also and does not burden the database server more than required. Further effective use of computing power gives best performance and complex calculations even on the big data even with smaller machines for your personal use. Filtering, Sorting, Cube Analysis, Inter Panel Communication on the dashboards all at lightning speed. Thereby, making best open-source Business Intelligence solution in the market.
It handles huge volumes of data effectively. Caching, Pagination, Load-Balancing and In-Memory not only provides you with amazing experience, but also and does not burden the database server more than required. Further effective use of computing power gives best performance and complex calculations even on the big data even with smaller machines for your personal use. Filtering, Sorting, Cube Analysis, Inter Panel Communication on the dashboards all at lightning speed. Thereby, making best open-source Business Intelligence solution in the market.
With advance NLP algorithm, business users simply ask questions like, “show me sales of last quarter”, “average monthly sales of my products”. Let the application give the power to users without knowledge of query language or underlying data architecture
With advance NLP algorithm, business users simply ask questions like, “show me sales of last quarter”, “average monthly sales of my products”. Let the application give the power to users without knowledge of query language or underlying data architecture
Our application is compatible with almost all databases, be it RDBMS, or columnar database, or even flat files like spreadsheets or csv files. You can even connect to your own custom database via JDBC connection. Further, our database connection can be switched dynamically based on logged in users or its organization or other parameters. So, all your clients can use the same reports and dashboards without worrying about any data security breech.
Our application is compatible with almost all databases, be it RDBMS, or columnar database, or even flat files like spreadsheets or csv files. You can even connect to your own custom database via JDBC connection. Further, our database connection can be switched dynamically based on logged in users or its organization or other parameters. So, all your clients can use the same reports and dashboards without worrying about any data security breech.
Our application can be installed on an in-house server where you have full control of your data and its security. Or on cloud where it is accessible to larger audience without overheads and maintenance of the servers. One solution that works for all.
Our application can be installed on an in-house server where you have full control of your data and its security. Or on cloud where it is accessible to larger audience without overheads and maintenance of the servers. One solution that works for all.
Different companies have different business processes that the existing BI tools do not encompass. Helical Insight permits you to design your own workflows and specify what functional module of BI gets triggered
Different companies have different business processes that the existing BI tools do not encompass. Helical Insight permits you to design your own workflows and specify what functional module of BI gets triggered