dc.js

d3.js filter() not displaying expected results

别等时光非礼了梦想. 提交于 2019-12-11 01:48:13
问题 The filter command is not working as I expected. How would I refactor the code to get the requested output? In the .filter((d,i) => condition) syntax, d is an object with the x (date/time string) and y (num cars produced that shift) axis values for that datapoint and i is the index of that datapoint on the linechart. Why does d.x != testdate# ? Note: testdate1 and testdate2 are datetime strings that precisely match two of the date/time strings in the datapoints While troubleshooting this, I

Increase margins for rotated axis labels with Crossfilter

北城余情 提交于 2019-12-11 01:39:03
问题 I need to increase the space for axis tick labels that have been rotated. The code below illustrates, and here's a working jsfiddle. Is this possible with crossfilter or do we have to get into the d3? HTML <script src="https://rawgit.com/square/crossfilter/master/crossfilter.js"></script> <script src="https://d3js.org/d3.v3.js"></script> <script src="https://rawgit.com/dc-js/dc.js/develop/dc.js"></script> <span> <div id="petchart"></div> </span> JS j = [{'pet': 'Felis catus'}, {'pet': 'Canis

How to put data ranges in piecharts using dc.js?

流过昼夜 提交于 2019-12-11 01:31:40
问题 I have a pie chart for age, which currently has pie slices for every age there in the data set. Since the age range is wide, numerous thin slices are formed in the pie chart. I want to make it as a range, like one slice should show 0-18, another 19-30, and so on. How can I do this? Here is my code <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="bower_components/dcjs/dc.css"> <link rel="stylesheet" href="bower_components/leaflet/dist/leaflet.css"> <script src="bower_components/d3/d3

dc.js - how to group by unique id

99封情书 提交于 2019-12-11 00:39:57
问题 I'm using dc.js and crossfilter to create 3 rowcharts from a csv. The first two are straighforward but the third one needs to have a dimension set to multiple columns of my input csv, so i've restructured the data so that for every required column (with a value present) for that row, a new duplicate row is created with that columns value inputted under a new column. See below; old structure: ID --- rowchart1 --- rowchart2 ---- rowchart3 ----- rowchart3 ----- rowchart3 ----- 1 2 3 new

How to change tick's text with ordinal axis

浪子不回头ぞ 提交于 2019-12-10 23:29:44
问题 I have chart with next properties: barChart .width(width) .height(height) .dimension(dim) .group(group) .x(d3.scale.ordinal()) .xUnits(dc.units.ordinal) My axis tick looks like "ZZxBob", "PxBob" How to use split function by 'x' to each tick? 回答1: The axes are generated entirely by D3. You can use chart.xAxis() to retrieve the x axis object, and then axis.tickFormat() to change the way it's displayed. So, e.g. to display the part before x: barChart.xAxis() .tickFormat(function(l) { return l

How to avoid truncated bubbles when elasticX or elasticY

泄露秘密 提交于 2019-12-10 18:45:38
问题 When you have an elastic chart and bubbles that are close to an axis (or close to the borders of the graph), the bubbles are truncated https://github.com/dc-js/dc.js/issues/998#issuecomment-216927317 回答1: You can add extra padding (xAxisPadding and yAxisPadding), but as the padding are on both sides of the graph, you end up loosing a lot of space and having the bubbles packed in the middle. On workaround is to draw outside of the graph, so the bubbles are visible under the axis. To do that,

DC.js histogram of crossfilter dimension counts

泪湿孤枕 提交于 2019-12-10 17:34:45
问题 I have a crossfilter with the following data structure being inputted. project | subproject | cost data = [ ["PrA", "SubPr1", 100], ["PrA", "SubPr2", 150], ["PrA", "SubPr3", 100], ["PrB", "SubPr4", 300], ["PrB", "SubPr5", 500], ["PrC", "SubPr6", 450]] I can create a barchart that has the summed cost per project: var ndx = crossfilter(data) var projDim = ndx.dimension(function(d){return d.project;}); var projGroup = costDim.group().reduceSum(function(d){return d.budget;}); What I want to do is

How can hide dc.js row chart values if values equal zero

删除回忆录丶 提交于 2019-12-10 17:20:06
问题 How can we hide if row chart values equal zero in dc.js after filtering .We have a code like this: var kurum=data.dimension(function(d){return ""+ d.KURUM;}); var kurumGroup=kurum.group().reduceSum(function(d){return +d.INSIDANS}); kurumRowMapChart .width(300) .height(200) .margins({top: 5, left: 10, right: 10, bottom: 20}) .dimension(kurum) .group(kurumGroup) .colors(d3.scale.category10()) .elasticX(true) .ordering(function(d) { return -d.value }) .xAxis().ticks(4); This code works normally

Is it possible to make a legend for Bubble Chart?

こ雲淡風輕ζ 提交于 2019-12-10 15:13:38
问题 Currently there is no example on the internet for a bubble chart having a legend, using dc.js, with the dc.legend() function. that.sessions_scatterplot .width(830) .height(350) .transitionDuration(1000) .margins({top: 100, right: 10, bottom: 30, left: 25}) .dimension(that.dim_Source) .group(that.fact_Source_Sessions) .ordinalColors(["#70c5a4","#8cd4f2","#fdc976","#9d97c8"]) .colorAccessor(function(d){ return d.value.src_category; }) .keyAccessor(function (d) { var x = d.value.avg_time/d.value

How to color dc js scatter plot according to the column value

老子叫甜甜 提交于 2019-12-10 12:08:01
问题 I am trying to get a scatter plot using dc.js. From my csv data file, following scatter plot attributes are assigned: size of bubble --> No. of sessions, xaxis --> Average time on page, yaxis --> Bounce rate, number of bubbles --> Sources I also want the colors of bubbles to be decided using another column from the csv file. Colors --> source category. (Source category is the category of the sources. SO there are 8 categories currently in my data file and therefore i need 8 colors. Also i