dc.js

dataCount graph filtered by a dimension

孤人 提交于 2019-12-01 06:33:24
问题 I have a list of participants to various events as the data source eventid,participant_name 42,xavier 42,gordon 11,john ... by default, dataCount will say they are 3 participants, I need to display the number of events (so 2) I tried creating a dimension var event = ndx.dimension(function(d) { return d.eventid; }) but can't manage to use it in dataCount dc.dataCount(".dc-data-count") //.dimension(ndx) //working, but counts participants .dimension(event) // not working How do I do that? 回答1:

Disable brush resize (DC.js, D3.js)

十年热恋 提交于 2019-12-01 06:24:50
Brush extent needs to be changed only from a dropdown as shown here: https://jsfiddle.net/dani2011/67jopfj8/3/ Need to disable brush extending by: 1) Extending an existing brush using the handles/resize-area of the brush Gray circles are the handels: 2) Dragging a new brush by clicking on the brush background, where the haircross cursor appears. JavaScript file Removed the handles of the brush: timeSlider.on('preRedraw',function (chart) { var timesliderSVG = d3.select("#bitrate-timeSlider-chart").selectAll("g.brush").selectAll("g.resize").selectAll("*").data(data[0]).exit().remove();}) If

dc.js - display mouseover values from chart outside graph

偶尔善良 提交于 2019-12-01 06:06:36
I'm looking to create a stacked line graph similar to the following example: https://dc-js.github.io/dc.js/ However, in addition I would like a field above the graph that displays the current value of the mouseover. I.e. instead of having to pause for a second with the cursor on the graph, and then having a mouse over box come up, I would like the values to show outside the graph, similar to the way that they do in Google Finance (see how price and vol on top left of graph change as you mouseover). E.g. https://www.google.com/finance?q=apple&ei=MUiWVtnQIdaP0ASy-6Uo I would really appreciate

Add legend to pie chart in dc.js

妖精的绣舞 提交于 2019-12-01 05:33:56
I'm building a dc.js-based visualization where one of the charts is a pie chart. See: http://jsfiddle.net/luiseth/t8we6/ The peculiarity of my case is that the labels that this chart will display are usually rather long, so much that usually get clipped by the chart's container (the <div> ). So I thought of having them appear on a legend, but I haven't been able to figure how to have the legend appear to the right of the chart. How can I do that? Playing around with the width has not helped at all, since the chart gets positioned at the center of the <div> . My code at the moment is: chart

dc.js - display mouseover values from chart outside graph

别来无恙 提交于 2019-12-01 04:29:19
问题 I'm looking to create a stacked line graph similar to the following example: https://dc-js.github.io/dc.js/ However, in addition I would like a field above the graph that displays the current value of the mouseover. I.e. instead of having to pause for a second with the cursor on the graph, and then having a mouse over box come up, I would like the values to show outside the graph, similar to the way that they do in Google Finance (see how price and vol on top left of graph change as you

Rowchart select only a single bar in dc.js / crossfilter?

夙愿已清 提交于 2019-12-01 04:20:14
问题 I have a dc.rowchart that has 5 different "categories". Initially, all are selected. When I click on one, then only that one is highlighted. When I click on a second one... both the first and second one I clicked are highlighted. How can I make it/configure the rowchart such that only a single category is highlighted every time a bar is clicked? dc.filter("category1"); dc.filter("category2"); Both of these in sequence appear to "append" filters than replace. 回答1: Ethan's answer is almost

Disable brush resize (DC.js, D3.js)

耗尽温柔 提交于 2019-12-01 03:26:14
问题 Brush extent needs to be changed only from a dropdown as shown here: https://jsfiddle.net/dani2011/67jopfj8/3/ Need to disable brush extending by: 1) Extending an existing brush using the handles/resize-area of the brush Gray circles are the handels: 2) Dragging a new brush by clicking on the brush background, where the haircross cursor appears. JavaScript file Removed the handles of the brush: timeSlider.on('preRedraw',function (chart) { var timesliderSVG = d3.select("#bitrate-timeSlider

dc.js/crossfilter -> How to sort data in dc.js chart (like row) - Ascending x Descending

岁酱吖の 提交于 2019-11-30 16:34:13
How to sort data in dc.js chart (like row) - Ascending x Descending I want to reorder the chart (row/column) by specified attribute (like 'avg' -> ascending) I'm trying to use ".top()"... but unsuccessfully Thanks draft below jsfiddle -> ewr5Z/2/ You can use the ordering method: chart.ordering(function(d){ return -d.value }) If you write a custom reduce, you can have more flexibility: priceDimension = ndx.dimension(function(d) {return d.part_number; }); priceGroup = priceDimension.group().reduce( function (p, v) { ++p.count; p.sumPrice += v.price; p.avgPrice = p.sumPrice/p.count; return p; },

dc/d3 line chart crashing down to 0 on the y axis after filtering

安稳与你 提交于 2019-11-30 09:47:14
问题 When I apply a dimension filter to a dc.js graph, there are ugly lines where the line plummets towards the y axis. Is it possible in dc/d3 to not do this, i.e I would expect the graph to more resemble the following; 回答1: You can call defined directly on the dc created chart. chart .chart((c) -> dc.lineChart(c) .interpolate('linear') .defined((d) -> return !isNaN(d.y) ) ) The condition !isNan(d.y) can be anything you like that evaluates to true/false. Note that the d passed by defined is a d3

How to add zoom effect into dc.geoChoroplethChart?

自作多情 提交于 2019-11-30 05:43:32
问题 I started to use dc.js Library to create all kinds of graphs and I bumped into a problem when I was trying to create a Geo Choropleth map using dc.js and couldn't add the ability to zoom and move the map. All the examples I saw were using d3 and svg.. but once I used those examples, I couldn't use the data of dc.dimention and all the crossfilter calculations. for example my code is: d3.json("world-countries.json", function (statesJson) { geoChart.width(1000) .height(600) .dimension(countryDim