Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Charts 对于这个Fsharp图表Livechart示例,为什么不抛出引用集?_Charts_F# - Fatal编程技术网

Charts 对于这个Fsharp图表Livechart示例,为什么不抛出引用集?

Charts 对于这个Fsharp图表Livechart示例,为什么不抛出引用集?,charts,f#,Charts,F#,查看,在订阅时似乎没有活动的同步上下文 您应该在窗口初始化时创建图表,这将在应用程序运行后发生。运行,创建WPF同步上下文。是否提供调用堆栈?添加了调用堆栈。由于某些原因,调试器无法捕获它。查看,订阅时似乎没有活动的同步上下文。尝试在应用程序之后在窗口初始化中进行订阅。运行调用。哇,你说得对。非常感谢你!在let win之后的行中添加win.Loaded.Add,使其工作。 open System open System.Windows open FSharp.Charting open FS

查看,在订阅时似乎没有活动的同步上下文


您应该在窗口初始化时创建图表,这将在
应用程序运行后发生。运行
,创建WPF同步上下文。

是否提供调用堆栈?添加了调用堆栈。由于某些原因,调试器无法捕获它。查看,订阅时似乎没有活动的同步上下文。尝试在
应用程序之后在窗口初始化中进行订阅。运行
调用。哇,你说得对。非常感谢你!在
let win
之后的行中添加
win.Loaded.Add
,使其工作。
open System
open System.Windows

open FSharp.Charting
open FSharp.Charting.ChartTypes

[<STAThread>]
do
    let win = Window(Title="Chart")

    let data = [|for i=1 to 10 do yield (i, i*i)|]

    let e = Event<_>()
    let ev = e.Publish

    let chart = LiveChart.Line (ev) |> ChartControl
    let host = new Forms.Integration.WindowsFormsHost(Child=chart)
    win.Content <- host

    e.Trigger data // Throws an error here

    Application().Run(win) |> ignore
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at FSharp.Charting.NotifySeq.IObservable-1-ObserveOn@225-1.System-IObserver`1-OnNext(T value) in c:\GitHub\FSharp.Charting\src\FSharp.Charting.fs:line 226
   at <StartupCode$FSharp-Core>.$Event.h@174-1.Invoke(Object sender, T args)
   at Microsoft.FSharp.Control.FSharpEvent`1.Trigger(T arg)
   at <StartupCode$Charts>.$Program.main@() in C:\Users\Marko\Documents\Visual Studio 2015\Projects\Poker Experiments\Charts\Program.fs:line 20