I have 3 similar pie charts. They use same dimension but different groups so, their legends look the same. Instead of having 3 same looking legends, I'd like to bind only a single legend to those charts. I tried creating a legend separately and assign it to the charts, however, it didn't work. Is there actually a way to do such thing?
This is not directly supported by dc.js, but it is very similar to a legend on a composite chart. I think if you were willing to do some hacking, you could override the legendables function on the chart you want to put the legend with, and have it accumulate the legendables from its sibling charts.
Take a look at pieChart.legendables:
https://github.com/dc-js/dc.js/blob/master/src/pie-chart.js#L419
And then compositeChart.legendables
https://github.com/dc-js/dc.js/blob/master/src/composite-chart.js#L363
for inspiration.
If this is too much hacking for you, please file an issue. It would certainly be nice to support!
Related
I have lots of svg element containing each one a line chart. I'd like to display these charts at groups of four. If I understand well from the documentation, it'd be better to use a grid for this purpose since I can select position I want (single box of the grid) for a specific graph. Is it true, or is there another better way to do this?
NB: charts are built each one from different datasets and using d3.js and so javascript.
Thank you so much for the help.
If it's possible, I'd like you to show me a code snippet just to understand better.
Thank you again.
I want to display the labels and datasets of pie & doughnut charts on their sides. I searched for many options on the internet including stackoverflow, but couldn't find a relative solution for my case. Maybe I missed something.
Now I have:
I need to display the chart data on its side like this: (For my pie and doughnut charts above)
First of all, I dont see any bar chart here. Second, what library are you using for making charts? If you couldn't find proper option to display label in that library, I can recommend you to use Amcharts, its more flexible. Let me know if you get your desired results
I have a column chart made with Highcharts and I want to add lines associated with each column showing benchmarks. I know Highcharts has a concept of plot lines, where there is one benchmark value given for the whole chart, but in my case, each column needs it's own benchmark. Here is a super simple example of how I want this to look:
I have some ideas of how I could do this, but they all seem like kind of indirect solutions. I could implement the benchmark lines as another column series, and style them so that only the top of the column shows, or as a scatter series where the "points" are actually lines, but I don't know if either of those are possible and they sound like a complicated way to do something simple. Hopefully I'm just missing an obvious feature of Highcharts.
Does anyone know how to do this? Thanks.
I am working on d3.js and dc.js libraries from few weeks. I have created scatter plot in d3.js and bar graph in dc.js. I want to know that is there possibility to interact between these two different graphs created in two different javascripts. In short, is it possible to interact between two different graphs created in d3.js and dc.js?
thank you.
Not going to give you the codes, sorry.
You'll want to use crossfilter as the bridge between the graphs, though:
create a dimension which is for the scatterplot (different from the dimensions used in the dc.js charts, but same crossfilter instance)
react to the interaction in d3 and set the filter on that dimension
Often when creating a dimension for a scatterplot, you will use a key that is unique for each row, or barring that, the row index itself. If you search around for dc.js scatterplot or bubblechart, you ought to find examples.
Also dc.js has a scatterplot now. It needs some love and is not as feature-rich as the bubble plot, but it exists.
I am evaluating to change the graphics I generated so far using highcharts.js to d3.js
just for fun and I want to learn how d3.js works.
I wonder if there is something similar to the url below (see if you click on a pie it gives you new data), something dynamic and ready to use (or not to implement from zero).
What I wanna achieve, more or less...
http://lully.snv.jussieu.fr/gbif/mapping/graphs/examples/pie-legend.htm
thanks in advance
Pere
If you want to replace Highcharts, I think the only good open-source alternative available at the moment is Bob Monteverde's Novus charts library: http://novus.github.com/nvd3/. NVD3 has a nice pie chart and also has good legends. Take a look at all the charts from this library and you will see what I mean. You can also find a good pie chart in Stephen Boak's tutorial: http://blog.stephenboak.com/2011/08/07/easy-as-a-pie.html. Another interesting option is to look for Frank Guerino's questions on the D3 js google group. I would use NVD3 if I were you. It might need some adjustments, but it seems to be the best option currently. Good luck!
Simple function to generate Pie Charts utilisiing d3.js. This function is part of the http://xhprof.io/ project. It is able to handle datasets of arbitrary size. It has several options that allow for customisation, such as the label margin, circle radius and visibility of the percentage data (refer to the source code).
The demo is available at https://dev.anuary.com/858b33b7-bd66-507b-a9f1-533e4de79ba3/. The source code is available at https://github.com/gajus/pie-chart.