Is there a way to create a dimension for an attribute that has one or more values? for instance
{quantity: 2, total: 190, tip: 100, items: ["apple","sandwich"],
{quantity: 2, total: 190, tip: 100, items: ["ice-cream"]},
{quantity: 1, total: 300, tip: 200, items: ["apple", "coffee"]}
My goal is to create a cross filter that can filter records by size that has ordinal values. Is there a way to write a filter / dimension that allows me to say "I want all records to have the element" apple "?
The only workaround I can think of is to create a dimension for each element. For instance:
var paymentsByApple = payments.dimension(function(d) { return $.inArray("apple", d.items); });
var paymentsByCoffee = payments.dimension(function(d) { return $.inArray("coffee", d.items); });
The main problem is that I do not want to list and hard code all the different objects. Moreover, I can have many different items. Is there a smarter way to do this?
Thanks in advance!
source
share