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

Customizations to charts persist unexpectedly #82

Open
latkin opened this issue Jul 9, 2015 · 2 comments
Open

Customizations to charts persist unexpectedly #82

latkin opened this issue Jul 9, 2015 · 2 comments

Comments

@latkin
Copy link

latkin commented Jul 9, 2015

Motivated by http://stackoverflow.com/questions/31305580/fsharpchart-two-scales-on-same-graphic.

I assumed that "customizations" to chart objects were done in a non-mutating way, i.e. a fresh new chart was created with the specified customization, and the original was left unchanged.

But it seems that many customizations are "sticky," as if the original chart object has been mutated. This feels like a bug.

#load "../packages/FSharp.Charting.0.90.10/FSharp.Charting.fsx"

open FSharp.Charting
open System.Windows.Forms.DataVisualization.Charting

// displays, no title. good.
let chart =
    [1..10]
    |> List.map (fun n -> (n, n))
    |> Chart.Line ;;

// displays, with title. good.
chart |> Chart.WithTitle(Text = "Test") ;;

// displays, *with* title. why?
chart ;;
@latkin
Copy link
Author

latkin commented Jul 9, 2015

Perhaps more clear:

let chart =
    [1..10]
    |> List.map (fun n -> (n, n))
    |> Chart.Line

[chart |> Chart.WithTitle(Text = "ABC")
 chart |> Chart.WithTitle(Text = "XYZ")]
|> Chart.Rows

image

@dsyme
Copy link
Member

dsyme commented Jul 9, 2015

Yeah ideally it would not be like this. It was just how it was originally implemented and I think it turns out simpler because an underlying mutable chart specification is used to hold all the configuration information.

My guess is it would be a lot of work to fix this given the very large size of the chart specification parameter space.

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