How to build stacked bar chart overlapping with d3js - d3.js

I'm planning to use d3js for building a stacked bar chart which showing number of email was sent, opened and clicked, With normal stacked bar, there will be 3 blocks for each column, and stack on each other.
For example: Total email sent was 100, opened was 80 and clicked was 30, then there are 3 blocks with value of each one is 100, 80 and 30. But it's not showing exactly the statistic, so I would like to build an overlapping stacked bar like
Here is an example, but I didn't find any d3 chart or something else supports it, I guess we need to customize them.

I have created stack bar chart with brush and I think it is helpful to you, you need to pass data and also you need to specify x_label_KEY which is you want show on x axis.
I have passed different dataset but you can pass your data to check. For example you can download from here -
https://github.com/Umesh-Markande/D3-Graph-With-Brush/blob/master/stackBarWithBrush.html

Related

complex multipart clickable label on dc.js bar chart

I am new to dc.js. I want to build the chart pictured below:
On the top of each bar, there should be values like 2/3. This denotes the number of records for two different categories. I need to show each value in a different color.
Also I have a requirement that the values should be clickable to view the records in separate table when we click on the value.
Can anyone help on this?

Display multiple charts at a time.(Anylogic)

I have made a simulation consisting of multiple vehicle agents (about 17), but I can't figure out a way of how I can display time color charts related to each of those vehicles in the main agent. If possible I want it to be in a scroll view so that the user can scroll through the different time color charts. I want to make it sort of like a Gantt chart.
Sort of something like this
The image related to my query
Scrolling is impossible with current AnyLogic UI, unfortunately. You can, however, add buttons to manually "scroll up/down" and change what view area the user sees.
Re plotting itself, either create 17 charts manually and link them to the individual agents.
Or better, create 1 chart in the agent type, have the agent population embedded in Main and adjust the y-component of the chart presentation according to the agent index, something like 100 + (index*15)
Some example models use this approach so check if you find something similar there

dc.js cap ordinal bar chart

dc.js has a Cap mixin which allows one to limit the number of groups and display the remainder in an "others" group. How does one access this behavior or exclude the remainder in a bar chart?
I am using a bar chart as I want to show a top 5 with stacked data. For example, the top 10 car manufacturers based on the total of fleet and private sales (in separate stacks). I am using a function to dynamically generate 5 ordinals (i.e. car manufacturers) for the x axis in the order that I want, and the graph generates nearly as expected. However, a separate bar containing the values that don't fit into one of the x values is placed at the start of the graph.
I've added a snapshot of the chart below. Note that I've rotated it with renderlet so it's on its side.
How do I remove the extraneous bar (at the top)?
If not possible, I may contemplate using two row charts side by side with one flipped so that the origin is on the right.
Sigh, the bar chart is not capped, and the row chart is not stacked. Hope to fix that.
That extraneous bar looks... not right.
With capped charts, you can eliminate the "others group" by setting the othersGrouper falsy. With the bar chart you would have to implement a "fake group" using the techniques documented here:
https://github.com/dc-js/dc.js/wiki/FAQ#filter-the-data-before-its-charted
... at least for now.

Invert nvd3.js legend click function

So, in nvd3 charts, clicking on a legend entry basically filters that out of the chart window (for instance in the case of area charts). I want to invert this functionality..i.e. show the particular chart when its corresponding legend is shown and hide all the others...is there a way to do it?
It is similar to what happens when user hits the chart itself (i.e. only the one that is clicked is expanded and rest of the streams hide).
I am referring to this example: http://nvd3.org/ghpages/stackedArea.html
There's a radioButtonMode that should do exactly what you want. You should be able to set this on the chart, i.e.
chart.radioButtonMode(true);

Google Visualization - Annotated timeline legend

I have an annotated timeline chart that gets new data over ajax. It's working fine, new points come in and I redraw the graph. My graph has two lines, so there are two labels in the legend on top. For whatever stupid reason, every single time the graph is redrawn, the legend labels swap places! So it will say
• Foo 5.2 • Bar 3.6
And then I'll refresh (and there will be no new data, so the call to redraw is 100% identical to the previous one) and now it says
• Bar 3.6 • Foo 5.2
In the respective red and blue, of course. What on earth would possess the applet to do this? Is there any way I can control the order of legend labels? I couldn't find anything about it in the official documentation.
Try using google.visualization.DataTable. For example:
dataTable = new google.visualization.DataTable({cols:graphColumns, rows:graphRows});
chart = new google.visualization.AnnotatedTimeLine($('#chart_div')[0]);
chart.draw(dataTable)
I use it this way and don't have any problems with my legend values.

Resources