dc.js

How to sum all values for numberDisplay, excluding a category

谁说我不能喝 提交于 2019-12-23 23:24:04
问题 I have set of data where I want to apply filters by default to a numberDisplay. The data is something like this. data = [{category:'A',value:10}, {category:'B',value:10}, {category:'C',value:10}, {category:'S',value:10}, {category:'C',value:10}, {category:'A',value:10}] I am trying to create a number display which will show sum of values other than category 'S', I tried using fake groups but they are failing. What would be the best method to achieve this ? 回答1: You don’t need a fake group for

dc.js Using two reducers without a simple dimension and second grouping stage

倖福魔咒の 提交于 2019-12-23 22:53:27
问题 Quick question following up my response from this post: dc.js Box plot reducer using two groups Just trying to fully get my head around reducers and how to filter and collect data so I'll step through my understanding first. Data Format: { "SSID": "eduroam", "identifier": "Client", "latitude": 52.4505, "longitude": -1.9361, "mac": "dc:d9:16:##:##:##", "packet": "PR-REQ", "timestamp": "2018-07-10 12:25:26", "vendor": "Huawei Technologies Co.Ltd" } (1) Using the following should result in an

How to remove weekends dates from x axis in dc js chart

百般思念 提交于 2019-12-23 22:28:14
问题 I have data for every date from Jan 2018 and I am creating a stacked line chart out of that data. Every weekend the count of my data is zero, so every weekend it shows a dip in my graph (as data reaches to zero). I want to avoid that dip. I have a Date column as well as a Day column. The Day column has values from 1 to 7 representing each day of week (1 is Monday and 7 is Sunday). Can I modify my x axis or graph to show only weekdays data? Fiddle var data = [ { Type: 'T', Date: "2018-01-01",

Hide all text on y axis dc.js bar chart

耗尽温柔 提交于 2019-12-23 11:56:48
问题 I am creating a DC.JS based dashboard, but would like to figure out how to hide all of the text on the y axis of the bar chart as well as style the text on the x axis. Thanks 回答1: You should decrease ticks to zero: yourChart.yAxis().ticks(0); Note that this does not return a reference to your chart, so you cannot chain this method. You must put it on a separate line. Like this: var yourChart = dc.barChart('#your-chart').width(1024).height(50); yourChart.yAxis().ticks(0); 回答2: you should

Hide dc.js chart x-axis

为君一笑 提交于 2019-12-23 08:54:58
问题 As the image below, the x-axis is very messy due to big range of data. I wish to remove the x-axis, any luck? my current code: toneChart.width(300).height(280) .dimension(tone) .group(toneGroup) .title(function (d) { return ""; }) .ordering(function(d) { return - d.value }) .cap(10) .transitionDuration(750) .renderLabel(true) .colors(d3.scale.category10()) .elasticX(true); Thanks! 回答1: Via CSS one can hide the axes and text. Remove row chart's x-axis Add the following to your CSS (replacing

dc.js access data points in multiple charts when click datapoint in first chart

旧街凉风 提交于 2019-12-23 08:51:47
问题 Using different dimensions of the same dataset, there are three dc.js Line Charts on screen. When user clicks a datapoint on any lineChart, I wish to locate and return the data values for that corresponding point from all other charts, including the one clicked on. I am also attempting (on mouseover) to change the circle fill color to red for the datapoint being hovered, as well as for the corresponding datapoint (same "x" value) for all other charts. I am using the .filter() method but haven

How to filter data using DC, D3, and Crossfilter to produce a bar chart?

与世无争的帅哥 提交于 2019-12-23 02:39:18
问题 The following produces a bar chart that shows 4 people on the x axis and the number of times they show up on the y-axis.However I'd like to filter this data to only count the owner's if they have an ID of "A." Also, would it be possible to apply this filter with a button or an onClick handler so that the data is only filtered for ID of "A" upon pressing the button. See code below and jsfiddle here: http://jsfiddle.net/chrisguzman/y9xt2/ var data = [{ Owner: "Alyssa", ID: "A" }, { Owner:

dc.js onClick Listener Not Working

让人想犯罪 __ 提交于 2019-12-22 13:30:47
问题 I'm having trouble getting an onClick listener to work with a dc.barChart. According to this thread, clickable charts should have an onClick listener now. However, I've tried both chart.onClick = function and chart.on("click", function) without any luck. Below is the code I've tried to test whether the listener is working or not. var hubChart = dc.barChart("#hub-chart"); var dateHub = dateCF.dimension(function(d){ return d.hub;}), dateHubs = dateHub.group().reduceSum(function(d){ return d

Avoid multiple sums in custom crossfilter reduce functions

回眸只為那壹抹淺笑 提交于 2019-12-22 12:48:33
问题 This question arise from some difficulties in creating a crossfilter dataset, in particular on how to group the different dimension and compute a derived values. The final aim is to have a number of dc.js graphs using the dimensions and groups. (Fiddle example https://jsfiddle.net/raino01r/0vjtqsjL/) Question Before going on with the explanation of the setting, the key question is the following: How to create custom add , remove , init , functions to pass in .reduce so that the first two do

Stacked Bar Chart by Units & Percentage

给你一囗甜甜゛ 提交于 2019-12-22 12:26:33
问题 Summary I want to display a bar chart who's dimension is days and who's stacked categories is another (i.e. x-axis = days and stack = category-1), but then, rather than display the simple quantity-sum of each group/stack, I want to show the percentage of the day. JSFiddle https://jsfiddle.net/wostoj/L1q50d4g/ Details I have data with dates, quantities, and other classifiers. For the purpose of this question I can simplify it to this: data = [ {day: 1, cat: 'a', quantity: 25}, {day: 1, cat: 'b