[openspending-dev] [OpenSpending] 2-year date range possible in OS visuals?

Stefan Wehrmeyer stefan.wehrmeyer at okfn.org
Fri Apr 12 14:03:45 UTC 2013


Hi Adam,

this is possible through the aggregation API:

The dataset "berlin_de" contains data for 2012 and 2013.
The following API calls are thus equivalent:
http://openspending.org/api/2/aggregate?dataset=berlin_de&drilldown=Gruppe
http://openspending.org/api/2/aggregate?dataset=berlin_de&drilldown=Gruppe&cut=time.year:2013|time.year:2012

The format for cut is key:value|key:value. Key for year is time.year.

However, the current BubbleTree, DataTable etc. API is a bit limiting and can't do this without a little hack.

Currently you have this:
"cuts": {},
"year": 2011

Replace it with this:

"cuts": {"time.year": "2011|time.year:2012"}

So remove the "year" key and put it manually into cuts. Add additional years directly to that "time.year" key in cuts separated by a pipe character ("|").
This would be your whole dataset:
"cuts": {"time.year": "2011|time.year:2012|time.year:2013"}

It's dirty, but it works.

Cheers
Stefan

On 12.04.2013, at 12:58 , Anders Pedersen <anders.pedersen at okfn.org> wrote:

> Hi Adam,
> 
> Just forwarding your issue to the dev-list.
> 
> Cheers
> 
> On 11 April 2013 21:02, Adam Stiles <adam.d.stiles at gmail.com> wrote:
>> Hello,
>> 
>> Is it possible to have a date range for lines of data in an OpenSpending
>> visual, for example 2011-2013? We are visualizing a 2-year budget, but it
>> seems I have to choose one date for every line, even though half the entries
>> are 2011 and half are 2012.
>> 
>> Thanks for any suggestions,
>> 
>> Adam
>> 
>> 
>> --
>> Adam Stiles
>> 510.280.4862
>> 
>> _______________________________________________
>> openspending mailing list
>> openspending at lists.okfn.org
>> http://lists.okfn.org/mailman/listinfo/openspending
>> Unsubscribe: http://lists.okfn.org/mailman/options/openspending
>> 
> 
> 
> 
> --
> Anders Pedersen
> Community Coordinator
> OpenSpending
> Open Knowledge Foundation
> Twitter: @anpe
> Skype: anpehej
> 
> _______________________________________________
> openspending-dev mailing list
> openspending-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/openspending-dev
> Unsubscribe: http://lists.okfn.org/mailman/options/openspending-dev





More information about the openspending-dev mailing list