The questions relates to the following link:
How do I generate data for Google Visualizations on the server using WebSharper
I wanted to re-implement the above although using the latest version of Websharper (open source alpha release) but I receive the following error:
Failed to deserialize metadata for: IntelliFactory.WebSharper.Google.Visualization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=dcd983dec8f76a71
I opened a Client-Server Web Application; Here is the code for the respective files:
In Remoting.fs
namespace WebsiteX
open System
open IntelliFactory.WebSharper
open IntelliFactory.WebSharper.Html
open IntelliFactory.WebSharper.Google
open IntelliFactory.WebSharper.Google.Visualization
open IntelliFactory.WebSharper.Google.Visualization.Base
open IntelliFactory.WebSharper.EcmaScript
open IntelliFactory.WebSharper.Web
module Remoter =
[<Remote>]
let RandomData () =
let random = new Random()
let valueCount = 100
let maxValue = 300
let seriesCount = random.Next(5)
let data = new Base.DataTable()
data.addRows(valueCount)
|> ignore
let addSeries index =
let name = sprintf "Series %d" index
data.addColumn(ColumnType.NumberType, name)
|> ignore
Seq.init valueCount (fun index -> random.Next(maxValue))
|> Seq.iteri (fun valueIndex value -> data.setValue(index, valueIndex, value) |> ignore)
[0 .. seriesCount]
|> List.iter addSeries
data
In Client.fs:
namespace WebsiteX
open IntelliFactory.WebSharper
open IntelliFactory.WebSharper.Html
open IntelliFactory.WebSharper.Google
open IntelliFactory.WebSharper.Google.Visualization
open IntelliFactory.WebSharper.Google.Visualization.Base
open Remoting
[<JavaScript>]
module Client =
[<Remote>]
let dd = Remoter.RandomData()
[<JavaScript>]
let Main() =
Div []
|>! OnAfterRender(fun container ->
let visualization = new LineChart(container.Body)
let options =
LineChartOptions(
width = 400,
height = 240,
legend = Legend(position = LegendPosition.Bottom),
title = "Title")
visualization.draw(dd, options))
I didn't change anything in the Main.fs (it is the same as the provided template). I am not familiar so much with web development, so there might be an easy answer.
Why when I try to build it to I receive the following: Failed to deserialize metadata for: IntelliFactory.WebSharper.Google.Visualization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=dcd983dec8f76a71
I downloaded Websharper and installed the pre-release versions from Nuget. Using WebSharper.3.0.1.73-alpha and WebSharper.Google.Visualization.3.0.2.193-alpha
Fixed it by upgrading to WebSharper.3.0.3.76-alpha.. but when I run it in Google Chrome I get the following:
You called the draw() method with the wrong type of data rather than a DataTable or DataView
Thanks!