dc.js

Date Filters in DC.js

余生颓废 提交于 2019-12-06 01:37:32
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-count"></span> records <span id="titleCount"></span> <a class="btn btn-sm btn-success" href="javascript

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

时间秒杀一切 提交于 2019-12-05 20:55:15
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(function (d) { return ""; }) .elasticX(true) .colors(d3.scale.category20c()) .ordering(function(d) { return d

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

冷暖自知 提交于 2019-12-05 19:24:43
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. Any idea how can i divide and get the average? Please help. Stuck in this for almost 3 days. You need

Add percentages to the pie chart label in dc.js

淺唱寂寞╮ 提交于 2019-12-05 17:45:27
I have a pie chart for which I want to add percentages to the label. Here is a jsfiddle of the pie chart and the code is below. Right now the chart shows the actual values. I looked at the dc.js Getting Started and How-To Guide which is an example of a dashboard. It has the chart with percentages in the label. However, when I try to replicate the structure I get an error. For example, when I use the label function like so .label(function(d) {if(all.value){return d.key + " " + d.value / all.value();} .renderLabel(true) in the console it says that all is not defined. Also, the d.key returns

How to position labels on dc.js pie chart?

人盡茶涼 提交于 2019-12-05 16:08:25
I'd like to show labels for tiny slices ( chart.minAngleForLabel(0.05) ) avoiding text overlap. I added a renderlet that shifts labels toward outer edge: .on('renderlet', function(chart) { chart.selectAll('text').attr('transform', function(d, i) { var old = this.getAttribute('transform'); if (d.endAngle-d.startAngle > 0.3) { return old; } var xy = old.slice(10,-1).split(','); var m = 1.25 + (i%3) * 0.25; return 'translate(' + (+xy[0]*m) + ',' + (+xy[1]*m) + ')'; }) }) and i'm rather happy with it (the second image is after renderlet): but it makes annoying transitions -- labels move toward

How to make the dc.js charts responsive

北城余情 提交于 2019-12-05 10:40:21
问题 Is there a any way to make the dc.js charts responsive? I'm struggling a lot to make the charts fit the desktop size. I'm using Twitter Bootstrap 3. I store the width of the div to a variable and pass it to the chart width. This will not make the chart responsive. But on first load the charts get to the width according to the size of the screen. But now I face a challenge in it, that I have a different file for the dc.js chart. And I'm calling through a iframe . When I call it through iframe

dc datatable without grouping the rows

僤鯓⒐⒋嵵緔 提交于 2019-12-05 04:25:28
Is it possible to have a dc data table without showing the data in groups? I just want to show all the data across all groups! My code is as follows: dc.dataTable(".dc-data-table") .dimension(dateDimension) .group(function (d) { return '' }) .size(10) // (optional) max number of records to be shown, :default = 25 .columns([ function (d) { return getFormattedDate(d.dd); }, function (d) { return d.referredfor; }, function (d) { return numberFormat(d.cost); }, function (d) { return d.gender; } ]) .sortBy(function (d) { return d.dd; }) .order(d3.ascending) .renderlet(function (table) { table

dc.js - min value from group per day

人走茶凉 提交于 2019-12-05 02:59:30
问题 I have the following data structure and would like to display a lineChart with the minimum value of 'amount' (group) by Day (of date) (dimension). var data = [ {date: "2014-01-01", amount: 10}, {date: "2014-01-01", amount: 1}, {date: "2014-01-15", amount: 0}, {date: "2014-01-15", amount: 10 }, {date: "2014-02-20", amount: 100 }, {date: "2014-02-20", amount: 10 }, ]; Where as I would normally be doing something along the following lines, I'm not sure how to find the min in the group. var

how to create multiline chart using dc.js

筅森魡賤 提交于 2019-12-05 02:59:20
I'm making a multi line chart using the Dimensional Charting javascript library dc.js, which is based on d3 and crossfilter. i am new in dc.js library.i am trying to display the multiline chart using csv file.i cant understand how to create multiline chart following csv format. my csv column format is Age_19_Under Age_19_64 Age_65_84 Age_85_and_Over 26.9 62.3 9.8 0.9 23.5 60.3 14.5 1.8 24.3 62.5 11.6 1.6 24.6 63.3 10.9 1.2 24.5 62.1 12.1 1.3 24.7 63.2 10 2.2 25.6 58.5 13.6 2.4 24.1 61.6 12.7 1.5 24.8 59.5 13.5 2.2 i am trying foolowing code: {% extends "base.html" %} {% load staticfiles %} {%

dc.js and crossfilter reduce average counts per day of week

纵然是瞬间 提交于 2019-12-05 02:39:26
问题 I am struggle to get my crossfilter groups set up right. Maybe someone can drop a hint! My datastructure looks more or less this way: {datetime: "2014-01-01 20:00:00", id:1} {datetime: "2014-01-01 22:21:08", id:2} {datetime: "2014-01-02 12:00:23", id:3} etc... The dimension is on datetime to return the day of week: var weekdayDimension = ndx.dimension(function(d) { return new Date(d.datetime).getDay(); }); Now I have problems with the grouping. I want the average count of events per weekday.