dc.js cap ordinal bar chart - d3.js

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.

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?

How to build stacked bar chart overlapping with d3js

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

SSRS Matrix Tablix with Trend Chart in One Column And Stacked Bar Chart in Another Column

I need to combine a trend chart onto one column of a matrix and a stacked bar chart into another column – similar to this. I have a label that runs over the top, which is why I don’t want to do two separate matrixes side by side.
Right now I have two different datasets for each.
If it was a roll up bar chart – I could just join the data sets and use aggregations for the bar chart – but with the stacked bar chart the issue of nominal values is tripping me up.
Sorta figured it out.
The key was to make the stacked bar chart a subreport. Then in the SQL for the dataset, add a WHERE Label = [Label passed in from Matrix row]

How could I get a single d3 selection (or array of dom elements) that includes all the exiting elements as well as new and existing ones?

I'm trying to get a stacked bar chart to animate correctly as bars come and go. There's probably a good example of this somewhere (I'll ask as a separate question: How to correctly transition stacked bars in d3.js), but the examples I'm finding don't show transitions with individual stack elements exiting and entering.
My idea is to make a tween function that sets the y of each bar to the top of the of the bar beneath it. I want to make sure that as bars are exiting, they drag down the bars above them, and as they're entering, they push up the bars above them. And I don't want any gaps or overlaps midway through the transition.
But to get this to work, I would ideally have a list of all the bars--exiting, entering, existing--in order, and I would be able to tell which category each bar belonged to. So, I could kludge something together, assembling a single array from rects, rects.enter(), and rects.exit() (after something like
rects = d3.selectAll('g.barGroups').selectAll('rects').data(newData)
.)
But there's got to be a better way.

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