[英]Are options and WithSize etc in XPlot specific to only certain charts?
I've tried Chart.WithSize
and displayZoomButtons = true
in the FSLab tutorial, but nothing seems to change the output.我在 FSLab 教程中尝试过
Chart.WithSize
和displayZoomButtons = true
,但似乎没有任何改变输出。
Same thing in other projects using XPlot.GoogleCharts directly.在其他直接使用 XPlot.GoogleCharts 的项目中也是如此。
Am I missing something?我错过了什么吗?
Download Plotly 1.4.2 from nuget and replace the dlls in the FSLab packages directory for XPlotly (see Plotting with Xplotly Q ).从 nuget 下载 Plotly 1.4.2 并替换 XPlotly 的 FSLab 包目录中的 dll(请参阅使用 Xplotly Q 进行绘图)。 Then you can use Xplotly's controls to zoom in and out, save the chart, etc. For example:
然后就可以使用Xplotly的控件进行放大缩小、保存图表等操作,例如:
#load @"..\..\FSLAB\packages\FsLab\FsLab.fsx"
open XPlot.Plotly
open XPlot.Plotly.Graph
open XPlot.Plotly.Html
//open XPlot.GoogleCharts
let layout = Layout(title = "Basic Bar Chart")
["giraffes", 20; "orangutans", 14; "monkeys", 23]
|> Chart.Bar
|> Chart.WithLayout layout
|> Chart.WithHeight 400
|> Chart.WithWidth 700
|> Chart.Show
Very barebones charting solution using Plotly (and it works):使用 Plotly 的非常准系统的图表解决方案(并且它有效):
open Newtonsoft.Json
let html = """<head>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<div id="myDiv" style="width: 100%; height: 100%;"></div>
<script>
var data = __DATA__;
var layout = __LAYOUT__;
Plotly.newPlot('myDiv', data, layout);
</script>
</body>"""
let (=>) k v = k, (v:>obj)
let doPlot data layout =
let data = JsonConvert.SerializeObject data
let layout = JsonConvert.SerializeObject layout
let path = Path.GetTempPath() + DateTime.Now.Ticks.ToString() + ".html"
File.WriteAllText(path, html.Replace("__DATA__", data).Replace("__LAYOUT__", layout))
System.Diagnostics.Process.Start(path)
let layout =
[ "title" => "Plot"
"xaxis" => dict [
"title" => "Ticks"
"showgrid" => false
"zeroline" => false
]
"yaxis" => dict [
"title" => "Price"
"showline" => false
]
] |> dict
let data = [
dict [ "x" => [1999; 2000; 2001; 2002]
"y" => [16; 5; 11; 9]
]
]
doPlot data layout
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.