Skip to content

added fill_percent to params for insert, swap and remove - #946

Merged
Kully merged 17 commits into
masterfrom
dashboard-percent
Mar 7, 2018
Merged

Kully merged 17 commits into
masterfrom
dashboard-percent

Conversation

@Kully

@Kully Kully commented Feb 23, 2018 •

Copy link
Copy Markdown
Contributor

This PR accomplishes:

  • added fill_percent to params for insert, swap and remove
  • fix HTML preview to reflect fill_percent
  • update changelog
  • remove #TODOs from dashboard_objs.py

re: #711

@Kully

Kully commented Feb 26, 2018

Copy link
Copy Markdown
Contributor Author

@cldougl ready for a 👀

@cldougl

cldougl commented Feb 28, 2018

Copy link
Copy Markdown
Member

hey @Kully this looks good, I'm trying out some examples now! Are these changes intended to be backwards compatible?

Comment thread CHANGELOG.md Outdated
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [2.4.2] - UNRELEASED

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would say this is more of added functionality than a bug fix (do you agree?) so I think it should be version 2.5.0 based on: https://semver.org/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree they are not bug fixes. The question I have now about my message below is if we consider these points as backwards-compatible. Functionally the API is the same and produces dashboards that look the same. I just had to modify a test or two.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there no way to add this functionality as an option rather than the default so that it remains backwards compatible?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think it's worth it. There was a technical issue with, before, using pixels as the metric for slicing up the boxes (since it was always in half) but the new param uses percentage to insert the boxes next to a pre-existing box

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok got it 👍

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Kully did you get a chance to update this to 2.5.0 and update plotly/version.py as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no thank you for reminding me

@Kully

Kully commented Feb 28, 2018

Copy link
Copy Markdown
Contributor Author

hey @Kully this looks good, I'm trying out some examples now! Are these changes intended to be backwards compatible?

As far as I know, yes. fill_percent is defaulted to 50, so it behaves the same way before the changes.

There are a couple technically non-backwards compatible things:

  • The main container in an init dashboard dashboard.Dashboard() that holds all the boxes has size in %, not px. It's a small technical thing.
  • the default height and width of the HTML preview are bigger.

Comment thread plotly/dashboard_objs/dashboard_objs.py Outdated
my_dboard.insert(box_1, 'below', 2)
my_dboard.insert(box_1, 'right', 3)
my_dboard.insert(box_1, 'above', 4)
my_dboard.insert(box_1, 'above', 4, fill_percent=30)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

screen shot 2018-02-28 at 11 29 07 am

does this output for the example look correct to you @Kully ? Not sure right/left or above/below is working

@Kully Kully Feb 28, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Running the exact same code in my branch, I am getting this preview:
screen shot 2018-02-28 at 3 22 48 pm

My output is correct but yours is not. What could be different about our branches? (you are cloning from the latest commit I assume)

@cldougl cldougl Feb 28, 2018 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Kully running on your branch in python 2.7 I get the desired output but in python 3.6 I get:
image
We should make this consistent across python versions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

wow, that's interesting -
I'll investigate that (and probably need to add better tests)

@Kully

Kully commented Mar 2, 2018

Copy link
Copy Markdown
Contributor Author

@cldougl Now the API auto-sizes very similarly to the dashboard GUI. Ready for I believe a final look.

@cldougl

cldougl commented Mar 5, 2018

Copy link
Copy Markdown
Member

@Kully for python 2.7 and 3.6 I am getting this preview from the example:

screen shot 2018-03-05 at 11 12 14 am

Can you confirm that is correct? That is not what I was expecting from

my_dboard = dashboard.Dashboard()
my_dboard.insert(box_1)
my_dboard.insert(box_1, 'left', 1)
my_dboard.insert(box_1, 'below', 2)
my_dboard.insert(box_1, 'right', 3)
my_dboard.insert(box_1, 'above', 4, fill_percent=30)

@cldougl

cldougl commented Mar 5, 2018

Copy link
Copy Markdown
Member

@Kully can you also add an example of the easiest way to add 4 vertical boxes of the same height?

screen shot 2018-03-05 at 11 20 24 am

@Kully

Kully commented Mar 5, 2018

Copy link
Copy Markdown
Contributor Author

@Kully can you also add an example of the easiest way to add 4 vertical boxes of the same height?

# 4 equally stacked vectical boxes
import plotly.dashboard_objs as dashboard

box_1 = {
    'type': 'box',
    'boxType': 'plot',
    'fileId': 'username:some#',
    'title': 'box 1'
}

my_dboard = dashboard.Dashboard()
my_dboard.insert(box_1)
my_dboard.insert(box_1, 'below', 1)
my_dboard.insert(box_1, 'below', 1)
my_dboard.insert(box_1, 'below', 3)

screen shot 2018-03-05 at 8 36 06 am

@Kully

Kully commented Mar 5, 2018 •

Copy link
Copy Markdown
Contributor Author

Can you confirm that is correct? That is not what I was expecting from

Yes this is correct.

This is perhaps the weakest point in the API currently. box_id numbers (the numbers that appear in the HTML preview and correspond to a box in the layout) are generated on-the-fly. This just means that you need to look at where the numbers are placed after each insertion/deletion of a box to appropriate reference the correct box_id.

Does this make sense?

@Kully Kully closed this Mar 5, 2018
@Kully Kully reopened this Mar 5, 2018
@Kully

Kully commented Mar 5, 2018

Copy link
Copy Markdown
Contributor Author

I am going to edit plotly/dashboard_objs/dashboard_objs.py now so that box_1 is rewritten as box_a to avoid confusion. You suggested a similar variable-renaming to the docs a while ago.

@cldougl

cldougl commented Mar 7, 2018

Copy link
Copy Markdown
Member

💃

@Kully
Kully merged commit d6d777b into master Mar 7, 2018
@Kully
Kully deleted the dashboard-percent branch March 7, 2018 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants