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

Support for non-symmetric Tick Marks #59

Open
veillette opened this issue Jan 9, 2023 · 1 comment
Open

Support for non-symmetric Tick Marks #59

veillette opened this issue Jan 9, 2023 · 1 comment

Comments

@veillette
Copy link
Contributor

In phetsims/calculus-grapher#159, a designer requested that tick marks be present on only one side of the axis line. We are currently implement the tick marks vis bamboo TickMarkSet

In TickMarkSet we can only have symmetric tick marks

    this.chartTransform.forEachSpacing( this.axisOrientation, this.spacing, this.origin, this.clippingType, ( modelPosition, viewPosition ) => {
      const tickBounds = new Bounds2( 0, 0, 0, 0 );
      if ( this.axisOrientation === Orientation.HORIZONTAL ) {
        const viewY = this.edge === 'min' ? this.chartTransform.viewHeight :
                      this.edge === 'max' ? 0 :
                      this.chartTransform.modelToView( this.axisOrientation.opposite, this.value );
        shape.moveTo( viewPosition, viewY - this.extent / 2 );
        shape.lineTo( viewPosition, viewY + this.extent / 2 );
        tickBounds.setMinMax( viewPosition, viewY - this.extent / 2, viewPosition, viewY + this.extent / 2 );
      }
      else {
        const viewX = this.edge === 'min' ? 0 :
                      this.edge === 'max' ? this.chartTransform.viewWidth :
                      this.chartTransform.modelToView( this.axisOrientation.opposite, this.value );
        shape.moveTo( viewX - this.extent / 2, viewPosition );
        shape.lineTo( viewX + this.extent / 2, viewPosition );
        tickBounds.setMinMax( viewX - this.extent / 2, viewPosition, viewX + this.extent / 2, viewPosition );
      }
    } );

I'm unclear about how to proceed without creating a mess.

@veillette
Copy link
Contributor Author

Doing some research on the possible option field we can use to support this feature.
Google chart, d3.js and Excel use the following terminology for tickMarks
inside, outside, cross.
In the context of a chart, the three terms are (relatively) unambiguous for vertical and horizontal axes.

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

No branches or pull requests

1 participant