Skip to content

Feature: Range selectors #373

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

Merged
merged 53 commits into from
Apr 4, 2016
Merged

Feature: Range selectors #373

merged 53 commits into from
Apr 4, 2016

Conversation

etpinard
Copy link
Contributor

resolves #207.

@mdtusz @chriddyp @cldougl @alexcjohnson @jackparmer

Strongly inspired by http://api.highcharts.com/highstock#rangeSelector

Example

Given a time series, the following layout:

var layout = {
  xaxis: {
    rangeselector: {
      buttons: [{
        step: 'month',
        stepmode: 'backward',
        count: 6,
        label: '6m'
      }, {
        step: 'year',
        stepmode: 'to date',
        count: 1,
        label: 'year<br>to date'
    }, {
        step: 'year',
        stepmode: 'backward',
        count: 1,
        label: '1y'
    }, {
        step: 'all'
    }]
  }
};

gives

image

Limitations

  • Only works on x axes with type 'date' (can be auto-typed)
  • No MathJax characters in label
  • active and hovered fill colors are not configurable.
  • the width of the buttons isn't configurable (the width is determined by the text label width)
  • the gap between the buttons is constant and not configurable

etpinard and others added 30 commits March 30, 2016 12:10
- so that it can be separatly tested.
- change directory name to rangeselector (instead of range_selector)
- rename default func supplyLayoutDefaults (instead of supplyDefaults)
- require full module into cartesian defaults
- so that it can be separatly tested.
- change directory name to rangeselector (instead of range_selector)
- rename default func supplyLayoutDefaults (instead of supplyDefaults)
- require full module into cartesian defaults
- so that it works in all time zones
- and to make things more readable
- based off corresponding xaxis and yaxis domain
- use isLinkedToArray to describe 'buttons'
- crawl through layout attribute to convert all isLinkedToArray
  attributes to items object that plotly.py can parse
- fill in missing descriptions
- link range selector attributes in axis attributes
dflt: 'left',
role: 'info',
description: [
'Sets the range selector \'s horizontal position anchor.',
Copy link
Member

Choose a reason for hiding this comment

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

rm space between selector and \

expect(itemObj.role).toBe('object');

var role = np.get().role;
expect(role).toEqual('object');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cldougl @theengineear ⏫ needs to be satisfied for plotly.py to build to correct graph object.

Copy link
Contributor

Choose a reason for hiding this comment

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

@delekru https://github.com/delekru @etpinard @chriddyp
Can we please use Highchart's button styling? I think they did a good job
and its what users are familiar with:
http://www.highcharts.com/stock/demo/basic-line

On Fri, Apr 1, 2016 at 4:20 PM, Étienne Tétreault-Pinard <
[email protected]> wrote:

In test/jasmine/tests/plotschema_test.js
#373 (comment):

  •        );
    
  •        var name = np.parts[np.parts.length - 1],
    
  •            itemName = name.substr(0, name.length - 1);
    
  •        var itemsObj = np.get().items,
    
  •            itemObj = itemsObj[itemName];
    
  •        expect(isPlainObject(itemsObj)).toBe(true);
    
  •        expect(itemsObj.role).toBeUndefined();
    
  •        expect(Object.keys(itemsObj).length).toEqual(1);
    
  •        expect(isPlainObject(itemObj)).toBe(true);
    
  •        expect(itemObj.role).toBe('object');
    
  •        var role = np.get().role;
    
  •        expect(role).toEqual('object');
    

@cldougl https://github.com/cldougl @theengineear
https://github.com/theengineear [image: ⏫] needs to be
satisfied for plotly.py to build to correct graph object.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/plotly/plotly.js/pull/373/files/a671683931ac3856674bce3af7b5d988c0857cb5..1042f4f656c3e1ac14a365477a93c6d66d44b855#r58269266

etpinard added 3 commits April 4, 2016 10:08
- default style has fill with Color.lightLine
- active and hovered over buttons are shown in a darker grey (#d3d3d3)
stepmode: {
valType: 'enumerated',
role: 'info',
values: ['backward', 'todate'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Should there be a forwards mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe. HighCharts doesn't support it, so I didn't put it in the first iteration.

@etpinard etpinard merged commit 4d5262f into master Apr 4, 2016
@etpinard etpinard deleted the range-selector branch April 4, 2016 20:14
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.

Dropdown legend items
6 participants