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

Is it possible to add watermark to a plot? #30

Closed
ai-fwd opened this issue Mar 19, 2020 · 2 comments
Closed

Is it possible to add watermark to a plot? #30

ai-fwd opened this issue Mar 19, 2020 · 2 comments
Labels
Area: MissingAbstraction Plotly.js functionality that has to be implemented Type: Enhancement
Milestone

Comments

@ai-fwd
Copy link

ai-fwd commented Mar 19, 2020

Firstly, great work on this library! Love using it.

I'm trying to recreate this example: https://plot.ly/javascript/layout-template/#add-named-container-array-items

But I don't see a way to add Images to the Layout as they have done. Is there another way to get a watermark on the plot?

Thanks.

@kMutagene
Copy link
Member

Hi @ai-fwd,

Happy that you like it!

Not nearly all options of the original plotly library are wrapped in a typesafe manner. However, we are able to recreate any javascript example by using the dynamic object stlye (the type safe functions are infact just abstractions of this style), which you can create analogously to the javascript examples. While i could not get the templates to work quickly, using background images in the layout is pretty straight forward:


type LayoutImage () =
    inherit DynamicObj ()

let image1 = 
    let tmp = LayoutImage()
    tmp?name    <- "watermark_1"
    tmp?source  <- "https://raw.githubusercontent.com/michaelbabyn/plot_data/master/benzene.png"
    tmp?xref    <- "paper"
    tmp?yref    <- "paper"
    tmp?x       <- 0.40
    tmp?y       <- 0.9
    tmp?sizex   <- 0.7
    tmp?sizey   <- 0.7
    tmp?opacity <- 0.1
    tmp?layer   <- "below"
    tmp

let layoutUsingImage =
    let layout = Layout.init()
    layout?images <- [image1]
    layout

Chart.Line(x=[0; 1; 2; 3; 4; 5],y=[2; 4; 3; 0; 5; 6])
|> Chart.withLayout layoutUsingImage
|> Chart.Show

Rendered Chart:

image

Regarding templates, i think it would be quite useful having those, i will look into it when i find time

@kMutagene kMutagene added this to the Backlog milestone Jun 15, 2020
@kMutagene kMutagene added Area: MissingAbstraction Plotly.js functionality that has to be implemented Type: Enhancement labels Jun 15, 2020
@kMutagene
Copy link
Member

kMutagene commented Nov 18, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: MissingAbstraction Plotly.js functionality that has to be implemented Type: Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants