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

Implement the column config and row config in pivot table #4394

Conversation

ShirmineWang
Copy link

Column configuration:

  • User can set general configuration and conditional configuration
    for every column, not just metric.
  • The configuration includes color configuration, font weight
    configuration and format configuration.
  • Add the ColumnControl for user to set the column configuration.
  • Add the action SET_FETCH_COLUMNS for ColumnControl to get the
    newest columns rendered in the chart.
  • Add the process logic in the pivot table for different situation
    in column configuration.
  • Add the ColumnControl_spec to test functions in the ColumnControl.

Row configuration:

  • User can set color and font weight for rows containing certain cell.
  • Add the RowControl for user to set the row configuration.
  • Add the process logic in the pivot table for different situation
    in row configuration.
  • Add the RowControl_spec to test functions in the RowControl.

Priority of column config and row config:

  • User can set priority themselves.
  • Add the checkbox for user to set the priority.
  • By default, the column configution has high priority than row
    configuration.

in pivot table.

Column configuration:
- User can set general configuration and conditional configuration
  for every column, not just metric.
- The configuration includes color configuration, font weight
  configuration and format configuration.
- Add the ColumnControl for user to set the column configuration.
- Add the action `SET_FETCH_COLUMNS` for ColumnControl to get the
  newest columns rendered in the chart.
- Add the process logic in the pivot table for different situation
  in column configuration.
- Add the ColumnControl_spec to test functions in the ColumnControl.

Row configuration:
- User can set color and font weight for rows containing certain cell.
- Add the RowControl for user to set the row configuration.
- Add the process logic in the pivot table for different situation
  in row configuration.
- Add the RowControl_spec to test functions in the RowControl.

Priority of column config and row config:
- User can set priority themselves.
- Add the checkbox for user to set the priority.
- By default, the column configution has high priority than row
  configuration.
@ShirmineWang ShirmineWang force-pushed the feature-column-and-row-configuration-in-pivot-table branch from 546a572 to 66408ad Compare February 9, 2018 09:12
@xiaohanyu
Copy link
Contributor

@mistercrunch
Copy link
Member

Oh neat! Can we get a few screenshots to get an idea of how this looks?

@xiaohanyu
Copy link
Contributor

xiaohanyu commented Feb 13, 2018

@xiaohanyu
Copy link
Contributor

Hi, here's the "welcome" page for slice with pivot table viz type, we add two new sections in the left side menu:

image

Expanding column configuration:

image

Expanding row configuration:

image

@xiaohanyu
Copy link
Contributor

xiaohanyu commented Feb 13, 2018

Some test cases

column configuration:

  • Set all cell's background color to red (by selecting only the metric)

image

  • Set one column's background color to red (by selecting metric and columns)

image

  • Set all cell's background color to blue and set different color for different columns (first by selecting metric and set background color, then set color for different columns under metrics)

image

  • Text alignment for specific column (by setting text align for metric or column)

image

  • Specific formatting for specific column:

image

column configuration with conditional formatting

  • Set all cells with value greater than 20000 to red color background and bold font:

image

  • Set Set all cells of a specific column with value greater than 20000 to yellow color background:

image

  • Together with background settings from above, we can mark cells whose value is greater than 20000 with yellow color, while other cells with green color by setting background color for the whole column.

image

@xiaohanyu
Copy link
Contributor

column configuration for font option:

  • set all cells to bold font by setting a wildcard conditional expression like > 0.

image

  • set specific column font to bold:

image

  • set specific cells to bold font in a column:

image

@xiaohanyu
Copy link
Contributor

Row configuration:

  • Set rows's background color to red if content in that row contains specific word:

image

  • Set rows's font to bold if content in that row contains specific word:

image

@xiaohanyu
Copy link
Contributor

Priority between column configuration and row configuration:

  • Column configuration has high priority over row configuration (this is the default option):

image

  • Column configuration has low priority over row configuration:

image

  • A new "Prioritize Row Configuration" in "Pivot Opitions":

image

@xiaohanyu
Copy link
Contributor

xiaohanyu commented Feb 13, 2018

Hi, @mistercrunch

Above is the overall features of this so-called "column and row configuration". Actually, we have used superset for almost one year, and designed this feature from bottom up, improve piece by piece, and finally proposed this patch for community.

The basic design is:

  • should be a purely frontend implementation based on datatables state save and restore
  • put column configuration and row configurations settings to formData, just utilize superset's existing tools to save and restore table state

There're maybe some issues though:

  • store column/row configuration may cause url too long for browsers and backend server, need to adjust existing nginx or some other backend settings to accept long GET urls
    • solution: maybe we should switch from GET to POST for queries to avoid this kind of long url problem?
  • frontend performance: when user has complicated settings and big data tables, it really takes some time to render the whole table, need to figure out a way to improve this.

We're definitely sure that there should be some improvements over the UI/UX design, to make it more intuitive, so we propose this to community asking some feedback. And we think that this is a good starting point.

This feature is mainly designed for dashboard readers, they may be leaders of the team, just glance over multiple dashboard in minutes, and they need colors to mark the most important metrics in a table for them.

That's all, thanks.

@@ -584,8 +584,12 @@ def get_data(self, df):
# Display metrics side by side with each column
if self.form_data.get('combine_metric'):
df = df.stack(0).unstack()
parsed_columns = list(map(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this code is needed / wanted but maps in python are a bit convoluted. What about using list comprehension?

to_list = lambda x: [six.text_type(z) for z in x] if isinstance(x, tuple) else [x]
parsed_columns = [to_list(x) for x in df.columns.values]

Copy link
Contributor

@xiaohanyu xiaohanyu Feb 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, OK for us. Guido don't like map/reduce/filter, LOL.

@graceguo-supercat
Copy link

@xiaohanyu We had a PR to convert all charting request method from GET to POST here:
#3993
I just have it merged. Please let me know if it works for you!

@mistercrunch
Copy link
Member

Haven't dug deep in this PR yet, but it looks like colors are quite binary, as opposed to a spectrum. Seems like many may want more of a gradient to visualize their data more like a heatmap. ?

@xiaohanyu
Copy link
Contributor

@graceguo-supercat will definitely rebase the code.

@xiaohanyu
Copy link
Contributor

xiaohanyu commented Feb 14, 2018

@mistercrunch Yes, we only provide binary colors in this PR. However, we've already implemented a new internal feature that provides some gradient options by length or by color change, here're some screenshots:

a new table progress bar settings section

gradient by length:

image

image

gradient by color scale

image

image

We think this kind of feature should be proposed as a new feature, and we still need some time to rebase own internal patch.

@mistercrunch
Copy link
Member

Oh that looks neat!

@Stevie337
Copy link

Hi All,

Has this PR already been pushed?? Ifso in what build would this be?

@mistercrunch
Copy link
Member

@michellethomas do you think this conflicts with your goal of deprecating datatables?

@CasperLiu
Copy link

Hi xiaohanyu,

This PR looks beautiful and great, and is what we just need.

Appreciated your work!

Which superset version will this PR go to?

Regards
Jiaxu,
刘佳旭

@xiaohanyu
Copy link
Contributor

@CasperLiu Hi, we worked this PR on superset 0.22.1 version, so I think you can cherry pick this PR if you like it.

As you can see, the official superset decides to switch http request method from GET and POST, and it seems that deprecating datatable.js is WIP. So I'm afraid that this PR will not work for versions later than 0.22.1.

Besides, my team are busy again these days, so we don't have additional time to rebase this PR, sorry...

@pauldx
Copy link

pauldx commented Jun 12, 2018

@xiaohanyu Hi , Like the new PR. Any ETA when and what Superset release will have it ? thanks and good work . - Paul

@krishna9626
Copy link

When will we expect this feature in superset?

@Saajan
Copy link

Saajan commented Dec 11, 2018

Any update on this. Can someone implement this in new version .

@kristw kristw added the enhancement:request Enhancement request submitted by anyone from the community label Jan 23, 2019
@kalimuthu123
Copy link

is it work for 0.28 version

@mshiner
Copy link

mshiner commented Mar 14, 2019

I'm very interested in this feature as well - any news?

@mistercrunch
Copy link
Member

I'd recommend making this a plugin.

@kuvsh
Copy link

kuvsh commented Mar 20, 2019

Hello! I'm very intrested in this feature. When it will be released?

@mistercrunch
Copy link
Member

Please resubmit as plugin!

@rohitpawar2811
Copy link

@mistercrunch @xiaohanyu Hii I have to firstly ask that the row-configuration feature has been removed from superset-2.0.0 ?.
If yes then my question is why we removed that any issues faced on running that thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement:request Enhancement request submitted by anyone from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.