Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request for more pivot examples #95

Closed
gmculp opened this issue Dec 9, 2013 · 7 comments
Closed

request for more pivot examples #95

gmculp opened this issue Dec 9, 2013 · 7 comments
Labels

Comments

@gmculp
Copy link

@gmculp gmculp commented Dec 9, 2013

Good evening.

Are there any pivot examples out there that show how to:

  1. hide column axis attribute name labels (pvtAxisLabel) (e.g., if you were displaying years as the column headings, not to show the word "year" only the actual year values)
  2. customize the sorting to sort by hidden sort_key fields (type integer)
  3. utilize the getColKeys() and getRowKeys() to get the attribute values

Thank you!

Gretchen

@nicolaskruchten
Copy link
Owner

@nicolaskruchten nicolaskruchten commented Dec 10, 2013

Hi!

  1. is probably possible via CSS
  2. is not possible at all is now possible, see http://nicolas.kruchten.com/pivottable/examples/montreal_2014.html for example
  3. I'm not sure what you're asking about specifically... Can you give me some more details please?
@gmculp
Copy link
Author

@gmculp gmculp commented Dec 10, 2013

Hello, Nicolas!

  1. Yes, I could hide the Axis Labels with css and JQuery (I want to keep the row axis labels).
  2. I asked about the sort because my data are already sorted but pivot resorts them alphabetically. I guess I could add the sort keys as rows and then make invisible with CSS and then adjust the colspan property of the empty in the upper left hand corner.
  3. I adjusted the JQueryUI menu control to allow for user driven filtering (I am using jQuery.grep to handle the filtering because the pivot table is on an ASPX site and the server was having issues with the pivot filter functionality). I populate it by looping through the data and then generating a distinct array of values for each column and row attribute. It works fine but I was curious if I could get those distinct values using getColKeys() and getRowKeys(), instead. Perhaps I misunderstood the role of these functions.

Here's a screenshot:
image

On another note, I think sparklines would be a very cool enhancement!

Thanks!

Gretchen

@nicolaskruchten
Copy link
Owner

@nicolaskruchten nicolaskruchten commented Dec 10, 2013

The getRowKeys() and getColKeys() method on the PivotData class indeed return the row/col keys for the data being rendered, as arrays. For example in your screenshot above, the first row key would be represented as ["Borough","1","Bronx"]. You can't get the unique values for the attributes for your whole dataset this way, however, only for the data being rendered.

I agree that sparklines are pretty cool, and the way to do it would be to write a custom Aggregator component, which shouldn't be too difficult.

@marks
Copy link

@marks marks commented Jul 4, 2015

@nicolaskruchten I'm very interested in adding sparklines. Any guidance of how to do this or a skeleton (existing even?) aggregator which would be good to work off for a sparkline to the right of the pivot()? (My data is similar to screenshot above and I am looking to replace "Totals" (which I've hidden using CSS) with a sparkline

All the aggregators I've written so far are for the data cells, not a new column to the right of the data cells.

Thanks so much!

@nicolaskruchten
Copy link
Owner

@nicolaskruchten nicolaskruchten commented Jul 6, 2015

To replace the 'totals' column with a sparkline, my recommendation would be to write a bit of Javascript which would execute after the Table Renderer has rendered (i.e. run it from the onRefresh() callback) which would use http://omnipotent.net/jquery.sparkline/ to create a sparkline from the data which would be extracted from the table.

@marks
Copy link

@marks marks commented Jul 6, 2015

Ok great. That's close to what I did except since I was using pivot and not pivotUI I created the spark lines after initialization and not on refresh.

Would you want a PR for an example of this?

Mark

Mark Silverberg
(m) 512 826 7004
http://twitter.com/skram

On Jul 5, 2015, at 9:24 PM, Nicolas Kruchten notifications@github.com wrote:

To replace the 'totals' column with a sparkline, my recommendation would be to write a bit of Javascript which would execute after the Table Renderer has rendered (i.e. run it from the onRefresh() callback) which would use http://omnipotent.net/jquery.sparkline/ to create a sparkline from the data which would be extracted from the table.


Reply to this email directly or view it on GitHub.

@nicolaskruchten
Copy link
Owner

@nicolaskruchten nicolaskruchten commented Jul 6, 2015

Sure, I'd be curious to see what it looks like! Are you able to use one of the example datasets I already have in the repo, perhaps the Montreal weather data?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.