Chart.JS legend grouping - javascript

I'm wondering if there is any way in chart.js that I can group chart legends as I want.
eg: First set of Data 1 to Data 4 as one group & second set of Data 1 to Data 4 as one group.
DATA 1 DATA 2 DATA 3 DATA 4
Group 1
DATA 1 DATA 2 DATA 3 DATA 4
Group 2
Is this achievable?

Related

Grouped bar chart displaying cross tab between groups

I'm trying to make a group bar chart that gives the frequency of two group combos. I referred to this site for rollup and nest function reference:
http://bl.ocks.org/phoebebright/raw/3176159/
I'm trying to use my own dataset to create the following effect:
https://bl.ocks.org/bricedev/0d95074b6d83a77dc3ad
My current attempt with my own data, drug1.csv:
https://blockbuilder.org/lydiawawa/9efb5df76c08640316efbef702437db7
In the console, the grouped counts do not seem to generate the right distributions. Something is wrong with my rollup and nest
const nestedData = d3.nest()
.key(function(d){return d.s_category})
.key(function(d){return d.drug_cat})
.rollup(function(leaves) { return leaves.length; })
.entries(data);
Following is the desired cross tab distribution count of s_category x drug_cat :
1 2 3 4 5 6
2 367 35 8 1 1 1
3 223 24 4 4 2 2
4 29 5 9 1 2 3
5 37 1 3 3 2 26
Static chart:
In the animated bar graph that I attempted to create, cross tab count should be the y-axis, drug_c is the x-axis and s_category determines the groups of the bar graph. Thank you for any help!
The moment you use the nest generator you don't have drug_cat and count as properties anymore: you have key and values (or value for the inner arrays).
Here is your block builder changing the names of those properties: https://blockbuilder.org/GerardoFurtado/f4c825a5f8c92e87cc5a81591ba1f7c9

C3.js: plot categorical time series

I am trying to plot 6 superposed time series created by 3 sensors on 2 machines:
Sensor 1:
Time serie 1 (first machine)
Time serie 2 (second machine)
Sensor 2:
Time serie 3 (first machine)
Time serie 4 (second machine)
Sensor 3:
Time serie 5 (first machine)
Time serie 6 (second machine)
I found that c3.js is a perfect fit for my need here.
The only (big) problem is that c3.js plot only one label by chart like here:
As one can see, data1 (blue) correspond to one serie and data1 (orange) correspond to one serie, the same thing for data3 (green)
What I need :
I need the sensors to be my labels => 3 labels and 2 time series by label.
Is there a way to do it ?

In Highcharts, How to generate Column Drilldown chart with random numbers?

In highchart, Drilldown Column chart we have. In this I want to generate data randomly.
For example : Number is 300.
Then for this drilldown no. of data are 4. Hence need to divide this 300 into such a ways that where 4 no.s total should be 300.
Or add 4 numbers(drilldown data) and generate root number which will be 300.
How can we do this?

Displaying excess number of columns in heat map in highcharts

I'm using highcharts heat map in my project. I have 12 rows and 7 columns in my heat map. When i pass the data hard coded the chart is displaying as required with 12x7 matrix. Now i need to pass the data in a json object from my database. When i9 do so, it is showing me 12x12 matrix with last five columns being empty and space being wasted. How can i remove these extra five columns. The chart is expecting some data to be passed ,where it is not,and I have not given any labels so it is displaying it as numbers after 7th column as 8 9 10 11 12. Can someone help?
(edit after review).
Put fake data in the 'categories'. This will shrink the matrix back to 12x7, and you can suppress the display of the fake category data.

Easy comparison between table rows

I am using DataTables JQuery plugins and I would like to ask the following two questions.
Is it possible to have MIN or MAX or AVG values calculated (dynamically) at the end of each column?
For example:
A/A A B C
L1 2 3 4
L2 3 4 5
If I would like to prin line 3 with the Min Values of each columnt should have been:
L3 2 3 4
Is it possible to create another column D which will contain the result of a formula for each row? For example Di = Ai + Bi?
According to the above example the resulted table should be the following:
L1 2 3 4 5
L2 3 4 5 7
Can I somehow perform those operations through DataTables or I have to prepare the data before passing it to the DataTables?
Thanks.
PS:
I suppose I need something similar to this trirand.net/examples/grid/functionality/footer/default.aspx but for DataTables plugin. In addition to that I need some formulas for rows as well. – salamis just now edit
Use mRender ( http://datatables.net/ref#mRender ) for the last column. mRender, when used as a function, has access the the data source object for the row (third parameter), so you can easily do a quick sum and then return the calculated value :-).

Categories