This commit is contained in:
Achim D. Brucker 2018-07-11 23:23:04 +01:00
parent 37ce6e57e2
commit f2bc460025
1 changed files with 11 additions and 13 deletions

View File

@ -1,6 +1,6 @@
(*
* This file is part of the ExtensionDsLab project.
* Copyright (c) 2017 LogicalHacking.com
* Copyright (c) 2017, 2018 LogicalHacking.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -15,35 +15,33 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*)
#I @"../../packages/SQLProvider/lib/"
#r @"FSharp.Data.SqlProvider.dll"
#load "ExtensionDsLab.fsx"
#I "../../packages/FSharp.Data/lib/net40"
#r "FSharp.Data.dll"
#load "../../packages/FsLab/Themes/DefaultWhite.fsx"
#load "../../packages/FsLab/FsLab.fsx"
open LogicalHacking.ExtensionDsLab
open LogicalHacking.ExtensionDsLab.Archive.SqlConnector
open Deedle
open FSharp.Data
open XPlot.GoogleCharts
open XPlot.GoogleCharts.Deedle
#I "../../bin/LogicalHacking.ExtensionDsLab"
#r "LogicalHacking.ExtensionDsLab.dll"
open LogicalHacking.ExtensionDsLab.Archive.SqlConnector
// the connection string shall be of the form
// "Server=<DBHOST>;Database=extensions;User=<USER>;Password=<PASSWORD>"
let ctx = ExtensionDbProvider.GetDataContext(connectionStringOrDefault "")
// Log SQL: https://fsprojects.github.io/SQLProvider/core/querying.html
FSharp.Data.Sql.Common.QueryEvents.SqlQueryEvent |> Event.add (printfn "Executing SQL: %O")
let ctx = ExtensionDbProvider.GetDataContext()
let chartDownloads extIds = (List.map (fun e -> (series (getDownloads ctx e))) extIds)
|> Chart.Line
|> Chart.WithOptions (Options(legend=Legend(position="bottom")))
|> Chart.WithLabels extIds
chartDownloads ["lkllajgbhondgjjnhmmgbjndmogapinp"]
// chartDownloads (List.take 5 (getAllExtIds ctx))
let extData =
query {for x in ctx.Extensions.Extension do
select (x.Date, x.Name, x.Downloads) }