|
37 | 37 | obj.layout = struct(); |
38 | 38 | obj.url = ''; |
39 | 39 |
|
40 | | - %-UserData-% |
41 | | - try |
42 | | - [obj.UserData.Username,... |
43 | | - obj.UserData.ApiKey,... |
44 | | - obj.UserData.PlotlyDomain] = signin; |
45 | | - catch |
46 | | - errkey = 'plotlyfigConstructor:notSignedIn'; |
47 | | - error(errkey, plotlymsg(errkey)); |
48 | | - end |
49 | | - |
50 | 40 | obj.UserData.Verbose = true; |
51 | 41 |
|
52 | 42 | %-PlotOptions-% |
|
74 | 64 | obj.PlotOptions.LinkText = obj.get_link_text; |
75 | 65 | obj.PlotOptions.IncludePlotlyjs = true; |
76 | 66 | obj.PlotOptions.SaveFolder = pwd; |
77 | | - |
| 67 | + |
| 68 | + %-UserData-% |
| 69 | + try |
| 70 | + [obj.UserData.Username,... |
| 71 | + obj.UserData.ApiKey,... |
| 72 | + obj.UserData.PlotlyDomain] = signin; |
| 73 | + catch |
| 74 | + if obj.PlotOptions.Offline |
| 75 | + obj.UserData.Username = 'offlineUser'; |
| 76 | + obj.UserData.ApiKey = ''; |
| 77 | + obj.UserData.PlotlyDomain = 'https://plot.ly'; |
| 78 | + else |
| 79 | + errkey = 'plotlyfigConstructor:notSignedIn'; |
| 80 | + error(errkey, plotlymsg(errkey)); |
| 81 | + end |
| 82 | + end |
| 83 | + |
78 | 84 | %-PlotlyDefaults-% |
79 | 85 | obj.PlotlyDefaults.MinTitleMargin = 80; |
80 | 86 | obj.PlotlyDefaults.TitleHeight = 0.01; |
@@ -1008,10 +1014,14 @@ function delete(obj) |
1008 | 1014 | end |
1009 | 1015 |
|
1010 | 1016 | function link_text = get_link_text(obj) |
1011 | | - plotly_domain = obj.UserData.PlotlyDomain; |
1012 | | - link_domain = strrep(plotly_domain, 'https://', ''); |
1013 | | - link_domain = strrep(link_domain, 'http://', ''); |
1014 | | - link_text = ['Export to ' link_domain]; |
| 1017 | + if obj.PlotOptions.Offline |
| 1018 | + plotly_domain = 'https://plot.ly'; |
| 1019 | + else |
| 1020 | + plotly_domain = obj.UserData.PlotlyDomain; |
| 1021 | + end |
| 1022 | + link_domain = strrep(plotly_domain, 'https://', ''); |
| 1023 | + link_domain = strrep(link_domain, 'http://', ''); |
| 1024 | + link_text = ['Export to ' link_domain]; |
1015 | 1025 | end |
1016 | 1026 | end |
1017 | 1027 | end |
0 commit comments