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

Multicategory axis required mapTrace and dynamic assignment to be implemented #142

Closed
gaviei opened this issue Aug 24, 2021 · 0 comments
Closed

Comments

@gaviei
Copy link

gaviei commented Aug 24, 2021

The example "Bar Charts With Multicategory Axis Type" in https://plotly.com/python/bar-charts/#bar-charts-with-multicategory-axis-type requires the assignment of the property"Chart.X", which in the example is an array of arrays, and is plotted as two categories:

#r "nuget: Plotly.NET, 2.0.0-preview.6"
#r "nuget: Plotly.NET.Interactive, 2.0.0-preview.6"

open Plotly.NET

let x :Object list = [["BB+"; "BB+"; "BB+"; "BB"; "BB"; "BB"];[16; 17; 18; 16; 17; 18;]]

[
    Chart.Column(keys=[], values = [1;2;3;4;5;6])
    Chart.Column(keys=[], values = [6;5;4;3;2;1])
] 
|> Chart.Combine 
// couldn't find a way to use Chart.withX_Axis
// |> Chart.withX_Axis(Axis.LinearAxis.init(Tickvals = ["BB+"; "BB+"; "BB+"; "BB"; "BB"; "BB"]))
|> GenericChart.mapTrace(fun t-> 
                                t?x<-x // workaround
                                t) 
|> Chart.withLayout( Layout.init(Barmode = StyleParam.Barmode.Stack))

image

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

2 participants