D3.js how can I generate a variable width stacked chart (Marimekko chart) - d3.js

I would like to generate a stacked bar chart (similar to http://bl.ocks.org/mbostock/1134768) where the total height of each bar is the same and the width varies. This kind of chart is also known as Marimekko chart.
So far my attempts to make the width vary based on a value in the csv file have failed.
Any suggestions would be appreciated.

The Marimekko chart at http://bl.ocks.org/mbostock/1005090 is what I was looking for.

Related

How to align the x axis with the chart points in a dc.js ordinal line series chart? [duplicate]

I am trying to create a composite chart and my requirements are to draw a bar chart, a line chart and a dotted line chart. For that I draw a composite chart. Now I am having problem that points of line chart starts from start of bar chart, but I need that to start from center of line.
You can see the problem in this JSFiddle.
I got some help from Stackoverflow that is:
Align points in centre of bars (DC.JS composite chart)
Seems like a workaround is to assign ._rangeBandPadding(1) the composite chart. Though as mentioned in the github thread that breaks the bar sizes, so adding .gap(1) and .centerBar(true) to the bar chart got everything looking nice.
but after that I got this output
[http://jsfiddle.net/nauman3128/nr0rgzvc/9/][2]
I can't explain why this works, but with some odd combination of range bands and old-style .gap(1), I was able to get it to draw properly.
The trick is
._rangeBandPadding(1)
on the composite chart, and
.gap(1)
.centerBar(true)
on the child bar chart, pretty much as stated in the original question. So this is essentially a duplicate of the earlier question and answer, but I've applied it to your JSFiddle in this fork:
http://jsfiddle.net/gordonwoodhull/nr0rgzvc/22/
Also, it's important not to set barPadding for the child bar chart. So we are using range-band layout for the composite, and classic gap-padding for the bar chart, which sounds like a very bad idea... but the output looks okay!

Add space between bar in multibarchart from nvd3

How could I add some space between two bars from the same group, in NVD3 chart?
I try chart.groupSpacing(0.5) but nothing changes...
I can't put any pictures because I need at least 10 reputation.
The groupSpacing changes distance between groups of bars.
var chart = nv.models.multiBarChart()
.groupSpacing(0.5)
;
I've created an example here
If you want to add space between bars within a particular group then you'll need to modify nvd3 source or write a multibar using pure d3.
This answer will be useful How to add space between bars in a grouped bar chart in a nvd3 grouped multibar chart?

How can I make a 100% stacked chart with nvd3?

I looked at nvd3 stacked charts, and does anyone know how can I make a 100% stacked chart with nvd3?
For example, a chart like this: https://www.syncfusion.com/content/en-US/Products/Images/wpf/chart/wpf-chart-ColumnStacked100.jpg
I used the multibar chart and then transformed the data to simulate a 100% stacked bar chart. I had to add each of the bar's values and then divide value in the bar by the total value of the bar.

d3 bar chart does not extend to full width of svg

I have a bar chart (http://tributary.io/inlet/4720197) that plots a dataset with a large number of points that I can't get to fill the entire width of the svg. I had the same issue with a line chart and was able to resolve by using rangePoints.
I've been attempting something similar with this chart but can't quite get the right combination (it's using two scales for the grouping) and am unclear how to get the side-by-side bars that I previously accomplished with rangeBand() given that function does not exist with rangePoints. What am I missing?

Tooltips getting cutoff in pie charts in highcharts

I have a pie chart which is being generated from a json string. The pie is getting created correctly but what is happening is the tooltip is getting cutoff when the text to be displayed in the tooltip is large. I have tried increasing the width and height of the svg area. But the charts are generated dynamically so i have no way of setting the chart widht and height dynamically depending on the content.
One can adjust the margins margin:[0,100,0,100], to shrink the pie chart so that the tooltips/labels will appear. This has been set to automatically scale the chart in Highcharts 3.0.
http://www.highcharts.com/component/content/article/2-news/53-highcharts-3-0-beta-released
http://github.highcharts.com/v3.0Beta/highcharts.js
http://jsfiddle.net/Zvrt6/1/
Increase Height and width of your chart div or put your code in jsfiddle if possible, so that we can get more idea
This example could be relevant to your situation- http://jsfiddle.net/4ac8b/1/. When you re-size the result pane you will notice the chart size changes accordingly.
You will need to set the size of your container so that the chart is drawn in that area itself. http://jsfiddle.net/4ac8b/. Even when you re-size the result pane the chart size wont change.
Change the diameter of your pie chart to allow additional information
http://www.highcharts.com/ref/#plotOptions-pie--size

Resources