dc.js

Crossfilter dimension and group to filter out data below certain threshold

寵の児 提交于 2019-12-10 10:55:11
问题 I have the following data, and I am trying to plot 2 bar charts: Total units of a given type Units of a type less than version 2.0 Where x-axis in both the charts is the type of unit. The charts are fine. The problem is: When I select the bar on the 2nd chart I expect to see only units with version < 2.0 in the data table and the 1st chart i.e. one record in this case. But what I get is all the units of that particular type (which is what I expect if I click on a bar in first chart) i.e. 3

Date Filters in DC.js

ぐ巨炮叔叔 提交于 2019-12-10 10:16:38
问题 I am working with DC.js and I am trying to add preset date filters to this jsfiddler. <div id="header" class='row logoSize'> <img src="logo-main2.png" /> <div class="buttons-container"></div> <div class="startEnd" id="start">2015-02-12</div> <div class="startEnd" id="end">2015-02-17</div> <div class="startEnd" id="brushYears">gggg</div> </div> <div class='row '> <div class="dc-data-count"> <h2> Card Activity Report <span> <span class="filter-count"></span> selected out of <span class="total

how to display bottom data for row chart using dc.js

心已入冬 提交于 2019-12-10 10:03:57
问题 I'm making a rowchart using the Dimensional Charting javascript library dc.js, which is based on d3 and crossfilter. i am display the rowchart for top(10) data.but i am trying to display rowchart for bottom(10) data but graph can be display same as the top(10) data.how to display bottom(10) data. constRowChart.width(350) .height(1000) .margins({top: 20, left: 120, right: 10, bottom: 20}) .transitionDuration(750) .dimension(density) .group(const_total) .renderLabel(true) .gap(1) .title

dc.js - how to get the average of a column in data set

淺唱寂寞╮ 提交于 2019-12-10 09:56:17
问题 I have this below data. col1 col2 value a 01/01/14 10 a 01/01/14 35 a 01/01/14 68 a 01/01/14 21 a 01/01/14 24 b 01/01/14 26 b 01/01/14 35 b 01/01/14 39 b 01/01/14 87 c 01/01/14 25 c 01/01/14 63 c 01/01/14 11 c 01/01/14 25 c 01/01/14 35 If I wanted to take the sum of col1. I could do it by using col1Dim.group().reduceSum(function(d) { return d.value }) . If I need the count i can replace sum with count. But I'm here loooking for average. So to that. I need to take sum of col1 and count of col1

D3.js/Dc.js different colored line segments for single line in line graph

天涯浪子 提交于 2019-12-09 23:50:56
问题 I have created a line chart in dc.js, which is built off of d3.js. I am doing a count on the y axis and hours on the x axis. I want the line to be blue between midnight-8am, orange from 8-12pm, red from 12pm-5, and green from 5pm-11pm. I have tried creating 4 different paths (an example of one is below) with different colors. The colors do show up but they add extra lines between the data points and some of the colors bleed together, especially if a lighter color is chosen. I have attached an

crossfilter - calculating percent of all records with a property

廉价感情. 提交于 2019-12-09 19:02:37
问题 here is my problem: i am using a python flask server that fetches json data from mongo db, and in there i specify what fields to import.This data is in json format and is fetched like that only. Is it possible to do transformations to these fields once passed through crossfilter in graphs.js? e.g. i have a status attribute which can take values "Pass","In Progress","on Hold" or "Fail". I basically want to do a metric which tells me percent failure. So ideally i have to do some calculations on

Adding a filter in dc.js / Crossfilter not updating the chart

笑着哭i 提交于 2019-12-09 17:44:17
问题 jsFiddle: http://jsfiddle.net/PYeFP/ I have a bar chart set up that graphs a users number of trips by day tripVolume = dc.barChart("#trip-volume") .width(980) // (optional) define chart width, :default = 200 .height(75) // (optional) define chart height, :default = 200 .transitionDuration(0) // (optional) define chart transition duration, :default = 500 .margins({ top: 10, right: 50, bottom: 30, left: 40 }) .dimension(tripsByDateDimension) // set dimension .group(tripsByDateGroup) // set

d3-tooltips for multiple linked dc.js charts

落爺英雄遲暮 提交于 2019-12-09 15:32:15
问题 I'm looking to modify the out-of-the-box tooltips for dc.js, and it seems there is a solution using d3.js tooltips as in this question. However, I'm confused about how to implement this so that the tooltip is modified for all linked graphs in a dc.js dashboard. The examples in the GitHub repo lend themselves well to individual graphs, but I'm currently working with six linked graphs and need to modify tooltips on all graphs. Any help would be appreciated. 回答1: Here is a good example of using

Composite Graph from Crossfilter Example

僤鯓⒐⒋嵵緔 提交于 2019-12-08 16:01:27
问题 Starting from the payments example crossfilter (https://github.com/square/crossfilter/wiki/API-Reference) how may we create a Composite Chart with one Line Chart for each payment type (tab, visa, cash)? 回答1: I am assuming you want to display payment totals over time (the date dimension) for each payment type . var payments = crossfilter([...]); var dateDimension = payments.dimension(function(d) { return new Date(d.date); }); Create a group of payment totals for each payment type (tab, visa,

d3-tip not working for a line chart

主宰稳场 提交于 2019-12-08 12:20:48
问题 I am trying to add tool-tip to a line chart made in dc but I am getting an error at : var lineTip = d3.tip() .attr('class', 'd3-tip') .offset([-10, 0]) .html(function (d) { return "<span style='color: #f0027f'>" + d.data.key + "</span> : " + numberFormat(d.value); }); The error is : Undefined is not a function I have used the following libraries. What am I doing wrong? Why is the function undefined? <g:javascript src="d3.js"/> <g:javascript src="dc.js"/> <g:javascript src="index.js"/> <g