Comments (8)
The 'fieldname' should be aggr_fieldname right?E.g.,
sum_profit
—
Sent from Mailbox
On Fri, Dec 12, 2014 at 4:11 PM, Dominik Moritz [email protected]
wrote:
{ fieldname:{min: value, max:value} if Q or {cardinality: value} if O }
Reply to this email directly or view it on GitHub:
#57
from vega-lite.
why?
from vega-lite.
Suppose we still allow casting binned Q
to be O
.
We should just get cardinality of the binned field instead of min
, max
.
For clarity, I will explain why min
, max
is insufficient first.
In that case, having min
, max
give us b.start
, b.end
, b.step
in the first part of code below.
bin.numbins = function(input){
var stats = {min: +Infinity, max: -Infinity};
input.forEach(function(d) {
var v = accessor(d);
if (v > stats.max) stats.max = v;
if (v < stats.min) stats.min = v;
});
var b = bins(stats, {maxbins: 20});
However, we still need to to go through the input to really get # of unique bins:
var uniqueBins = {}; // reset (HACK)
input.forEach(function(d) {
var v = accessor(d);
var vbin = b.start + b.step * ~~((v - b.start) / b.step);
uniqueBins[vbin] = 1;
});
return vg.keys(uniqueBins).length;
}
But the # of unique bin is actually cardinality of the new derived column from binning.
So maybe we just get cardinality of the resulting table.
from vega-lite.
Okay, if we don't want to show empty in, then I agree with your first point about min and max not being sufficient. But in that case we will just use the cardinality of the query result.
I do not agree with your second point because if we have only a small number of non-empty (is that what you mean by unique?) bins, then we might want to make them smaller. But let's maybe not worry about this case for now and just use the cardinality of the query result as you said.
from vega-lite.
Okay, if we don't want to show empty in, then I agree with your first point about min and max not being sufficient. But in that case we will just use the cardinality of the query result.
If we don't hide empty bins, we should not cast the data to be ordinal because ordinal scale would not know about empty bins. (It just use the output from binning fn as ordinal).
In the case the we keep the binned Q
to be Q
type. We don't even need cardinality
(# of non-empty bins)/# of bin
because we can assume that it will be roughly below 20. (But having the # of bin
-- including empty ones -- is a little helpful.)
(is that what you mean by unique?)
Yeah uniqueBins
= unique non-empty bins.
then we might want to make them smaller
make what smaller? (what is them?)
from vega-lite.
Well, the binning function could return empty bins as well (maybe need to refactor code to support this, though).
them is the bins. Assume we have very dense regions, then we might want more bins because a lot of the bins are empty. This way we have a not so small number of non-empty bins.
Okay, let's go with the simplest version first. We only put min and max in the stats and if the user chooses O, we just take the cardinality of the query result but not change the bin size.
from vega-lite.
Ok. The simplest version didn't even need min
, max
for size calculation though.
But you should go ahead and implement min
, max
as they are useful for brushing & link + dynamic query, which should be included in the UI somehow anyway.
from vega-lite.
Well, we need min and max to calculate optimal bin sizes.
I'm working on the stats part.
from vega-lite.
Related Issues (20)
- Domain is behind bars for horizontal bar chart. Incorrect z-index
- Gap between marks on discrete scales if the chart size is not an even multiple of the number of steps HOT 2
- Setting `binSpacing` to 0 still leaves a gap between marks HOT 2
- Make javascript: urls work as values of href HOT 6
- Layer superimposing does not work as expected when both layers have `fill` or `color` specified HOT 2
- Support `bandPosition` for area marks
- Adding domain to scale on bar charts cause phantom bar to show up HOT 2
- Overwriting heigth and width values in concat operators HOT 2
- Documentation for Typescript usage needs to highlight that the spec should be declared "as const".
- Not possible to independently resolve latitude / longitude in concatenated geoshape chart with same projection HOT 2
- Your documentation for bullet chart has wrong label alignment HOT 1
- Bug (?): Incorrect Compilation of Signal Names in Bin Parameters Resulting in Non-Unique Dataset Names
- Default invalid value handling lacks stability between mark types
- Line with invalid null broken
- Stacked area charts broken in >=5.14.1 HOT 1
- Binned stacked area doesn't correctly filter null
- Transform calculate split not working properly since 5.18
- Adjust style to better work with negative values
- Adopt ResizeObserver for "container" width/height?
- Should Vega-lite always include color for invalid by default?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vega-lite.