Skip to content

Put X-Labels at an angle #300

Closed
Closed

Description

@SeidChr

I know it from the usual tools like excel or google spreadsheets, that you can have X-labels that are printed at an angle, so there can be more lables on less space:

image

Couldnt find a way to do this with ScottPlot. Can you add it?

Activity

  1. swharden commented on Mar 14, 2020

    @swharden
    Member

    Thanks for the suggestion @SeidChr! This would be a great improvement, especially for date ticks.

    A small gotcha would be that the layout-detecting code currently uses tick label height to determine how much space to allocate for the lower ticks, but once we get ticks rendering at an angle I can adjust the layout code to accomodate it.

    Would you be interested in giving this a try? Horizontal ticks are rendered in this code block. I'd suggest starting by hard-coding a 45º angle, then later worrying about how to let the user select this.

    https://github.com/swharden/ScottPlot/blob/69ede7b1e6cdb80eaea81567e617db599b9868c1/src/ScottPlot/Renderer.cs#L273-L274

  2. swharden commented on Mar 15, 2020

    @swharden
    Member

    I'll tackle this now. I can get code hints from the solution of #160:

    settings.gfxData.TranslateTransform((int)textLocationPoint.X, (int)textLocationPoint.Y);
    settings.gfxData.RotateTransform((float)rotation);
    settings.gfxData.DrawString(text, font, brush, new PointF(0, 0));
    settings.gfxData.ResetTransform();
  3. swharden commented on Mar 15, 2020

    @swharden
    Member

    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions