Skip to content

In Chart.withLegendStyle, StyleParam.XAnchorPosition does not seem to have an effect #289

Description

@nhirschey

Description

When I try to orient a legend, YAnchorPosition works as I expect but XAnchorPosition does not seem to have an effect.

Repro steps

#r "nuget: Plotly.NET"

open Plotly.NET

let xs = [1.0 .. 4]
let y1 = xs |> List.map (fun x -> x * 2.0)
let y2 = xs |> List.map (fun x -> x * 3.0)

These charts look the same to me:

// left
[Chart.Line (xs, y1); Chart.Line (xs, y2)]
|> Chart.combine
|> Chart.withTitle("Left")
|> Chart.withLegendStyle(Orientation=StyleParam.Orientation.Horizontal,
                         X=0,
                         XAnchor=StyleParam.XAnchorPosition.Left)
|> Chart.show

// right
[Chart.Line (xs, y1); Chart.Line (xs, y2)]
|> Chart.combine
|> Chart.withTitle("Right")
|> Chart.withLegendStyle(Orientation=StyleParam.Orientation.Horizontal,
                         X=0,
                         XAnchor=StyleParam.XAnchorPosition.Right)
|> Chart.show

image
image

Expected behavior

I expect the left chart to be as it is but I expect the right chart's legend to be right-aligned at x=0.

Actual behavior

the legend positions are the same.

Related information

  • Operating system Windows 11
  • .NET 6,

Activity

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