I'm pretty new to D3 and NVD3. I'm playing with the line chart example which works great except for one thing: it cuts of the legend text as shown in the screen shot below. In the picture, it says "Mean Size Distributi..." instead for writing out Distribution.
Going through the source for NVD3s legend module, I can't seem to find a setter for the legend width. Any ideas?
chart.legend.maxKeyLength(100);
This will set maximum text length of legend as 100.
Related
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!
I have a graph of two lines, one of type solid, the other of type dashed, however the legend shows them both as solid. Is there a way to have the dashed line show up in the legend to accurately reflect what line matches what legend data?
Though this feature is currently not available, you can workaround this problem by setting legendMarkerType to "triangle" with color same as that of chart background. Here is a jsfiddle.
legendMarkerType: "triangle",
legendMarkerColor :"white",
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?
I have a line chart, where the chart legend also in forms of line. Is there a way I can change the legend type from colored line to colored circle or square?
Figure like this. http://www.nevron.com/gallery/FullGalleries/chartActiveX/stackline/images/StackLine1.png
I don't think you can use this method to get circles, but if you want to get squares, you can change the chart to a 3-D line chart, then right-click the chart area and select '3-D Rotation'. Change everything in the Rotation section of the menu to as close to 0 as you can get it. This will make your chart show up as a regular line chart while the legend shows little cubes. After you've done that, though, you'll probably have to change the axis settings. In my experience, 3D charts tend to show too many gridlines.
The default chart object in the SQL Server (2005) Business Intelligence Development Studio doesn't seem to some have formatting options like :
specifying the text direction of labels in the x and y axis
adding a trendline to a bar chart
arbitrarily resizing items in a chart - for example, if I resize the chart object, everything gets resized accordingly but I can't keep the size of the chart the same while extending the area of the legend for instance.
multiline chart labels
So what I want to know is
is there any easy answer to the formatting problems mentioned above?
what websites/books/resources/examples would you recommend I look
into for extending the functionality of the chart object?
Some colleagues of mine gave up on the stock control and bought Dundas charts
The stock charts are cut down versions of Dundas.
yes you can specify the text direction of labels in the x and y axis
Go to chart properties and in the tab x and y axis enter the chart title and in the title align use the combination like left/right/center align.
you can change the legend line go to the chart properties click legend tab inside this
there is an option for "display legend inside plot area" and you can include the trendline there
you can use multiline text labels when the text limits extends
I don't see how you can resize the legend, puting inside the plot area looks ugly for pie-chart
I'd recommend go with the dundas chart components gbn suggested.
If that's not possible at least this article should solve issue 1.