dc.js

.colors function in barChart dc.js with only two options

╄→гoц情女王★ 提交于 2019-12-05 02:04:58
问题 I want to create a color function which shows red when the value is negative and green otherwise in a barChart. Here is what I've come up with so far : var colorChoice = d3.scale.ordinal().domain(["positive","negative"]) .range(["#00FF00","#FF0000"]); hitsPerDaybarChart .colors(function(d) {return(colorChoice((d.hits>0) ? "positive":"negative"));}) But I get the following error message : TypeError: Object function (d) {return(colorChoice((d.pnl>0) ? "positive":"negative"));} has no method

How to filter views with an opacity range in d3/dc.js?

旧时模样 提交于 2019-12-04 19:35:29
I don't know if this is possible in dc.js and crossfilter.js , but I decided to ask anyways. I combined a scatterplot and a barChart example from dc to make an interactive dashboard: var chart1 = dc.scatterPlot("#test1"); var chart2 = dc.scatterPlot("#test2"); d3.csv("output.csv", function(error, data) { data.forEach(function (x) { x.x = +x.x; x.y = +x.y; x.z = +x.z; }); var ndx = crossfilter(data), dim1 = ndx.dimension(function (d) { return [d.x, d.y]; }), dim2 = ndx.dimension(function (d) { return Math.floor(parseFloat(d.z) * 10) / 10; }), group1 = dim1.group(), group2 = dim2.group(), chart1

Extending dc.js to add a “simpleLineChart” chart

ぐ巨炮叔叔 提交于 2019-12-04 16:16:14
edit See here for the non-working example of what I'm trying to do: http://bl.ocks.org/elsherbini/5814788 I am using dc.js to plot data collected from bee hives at my university. I am pushing new data to the graphs on every database change (using the magic of Meteor). When the database is over 5000 records or so, rerendering the lines gets really slow. So I want to use simplify.js to preprocess the lines before rendering. To see what I'm talking about, go to http://datacomb.meteor.com/ . The page freezes after a couple of seconds, so be warned. I have started to extend dc.js with a

Crossfilter filter based on textbox

假如想象 提交于 2019-12-04 14:26:00
问题 I would like to filter my data based on the input in a textbox. Is this possible? Something like this but with crossfilter. 回答1: Certainly possible with crossfilter , just create dimension objects from your raw data and then apply a filter by the input of the text box. myDimension.filter(valueFromBox); // selects values who equal the value in the text box Check out the API docs here. 来源: https://stackoverflow.com/questions/15615336/crossfilter-filter-based-on-textbox

Strategies to reduce DOM elements of large data sets

*爱你&永不变心* 提交于 2019-12-04 14:08:25
I have a large dataset that I want to display using dc.js. The amount of entries exceeds the available drawing space in pixels on the screen by far. So it does not make sense to render 20k points on a 500px wide chart and also slows down the browser. I read the Performance teak section of the wiki and thought of some other things: Aggregating groups using crossfilter (e.g. chunk the dataset in 500 groups if I have a 500px wide svg) simplify my data using a Douglas–Peucker or Visvalingam’s algorithm dc.js offers a neat rangeChart that can be used to display range selection that I want to use.

dc.js composite chart toggle chart

≯℡__Kan透↙ 提交于 2019-12-04 13:40:23
Is there a way to toggle charts on/off in a composite chart ? If I hover over Legend the respective chart is highlighted but it would be nice if we could choose which ones to display (hide/show with Legend, check boxes etc). I did find reference to hideStack but I don't think this is what I need. Any ideas? (Current DC Version: 2.0.0-alpha.2 ) You're right, legend toggling is currently focused on stacks and not the subcharts of a composite chart. It may be possible to hack the legend's toggling system, but here is a solution that just adds the toggling functionality as an extension. We'll just

Generating histogram for highly skewed data

久未见 提交于 2019-12-04 12:36:25
I'm using dc.js , crossfilter.js and d3.js to generate a barchart. The barchart represents data for credit card transactions. It plots number of transactions (y-axis) over transaction dollar amount (x-axis). It looks like this: The data array basically looks like: [ ... { txn_id: 1, txn_amount: 20 }, ... ] The data is highly variable depending on different merchants etc and I can't make any assumptions about distributions. As you can see this graph isn't all that useful because of the data itself. In this case there is 1 transaction for -$7500 and 2 at around $7500 . In between there other

Tooltips in DC.js ( D3 Library )

感情迁移 提交于 2019-12-04 09:02:19
DC.js has great functionality built-in to display tooltips per documentation .title([titleFunction]) function. Is there anyway to make the tooltips more like a bootstrap style tooltip similar to rickshaw's implementation ? 来源: https://stackoverflow.com/questions/21992972/tooltips-in-dc-js-d3-library

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

依然范特西╮ 提交于 2019-12-04 07:29:11
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 group // (optional) whether chart should rescale y axis to fit data, :default = false .elasticY(false) //

map json works on Geojson.io but it doesnt work on dc.js choropleth map

霸气de小男生 提交于 2019-12-04 05:29:14
问题 I created geojson turkey map on geojson.io. It works on geojson.io with no trouble.But it doesnt work on dc.js choropleth map. I checked it with us-states.json on my codes it works but my geojson map doesnt work. Here My created geojson: mygeojson 回答1: Without your code, hard to answer, but the problems I have usually with dc.js choropleth is 1) not using the right selector or key for overlayGeoJson(yourJson.features, "selector", function(d) { return d.name; }); yourJson.features: geo json