2017-08-06 19:39:04 +00:00
|
|
|
(*
|
2017-08-06 20:12:14 +00:00
|
|
|
* This file is part of the ExtensionDsLab project.
|
2017-08-06 19:55:24 +00:00
|
|
|
* Copyright (c) 2017 LogicalHacking.com
|
2017-08-06 19:39:04 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* the Free Software Foundation, version 3.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*)
|
2017-08-11 09:50:22 +00:00
|
|
|
|
2017-08-06 19:34:43 +00:00
|
|
|
#I @"../../packages/SQLProvider/lib/"
|
|
|
|
#r @"FSharp.Data.SqlProvider.dll"
|
|
|
|
|
2017-08-11 09:50:22 +00:00
|
|
|
#I "../../packages/FSharp.Data/lib/net40"
|
|
|
|
#r "FSharp.Data.dll"
|
2017-08-13 13:08:57 +00:00
|
|
|
|
|
|
|
#load "../../packages/FsLab/Themes/DefaultWhite.fsx"
|
|
|
|
#load "../../packages/FsLab/FsLab.fsx"
|
|
|
|
|
2017-08-12 19:47:35 +00:00
|
|
|
open Deedle
|
|
|
|
open FSharp.Data
|
|
|
|
open XPlot.GoogleCharts
|
|
|
|
open XPlot.GoogleCharts.Deedle
|
2017-08-11 09:50:22 +00:00
|
|
|
|
|
|
|
#I "../../bin/LogicalHacking.ExtensionDsLab"
|
|
|
|
#r "LogicalHacking.ExtensionDsLab.dll"
|
2017-08-11 09:57:46 +00:00
|
|
|
open LogicalHacking.ExtensionDsLab.Archive.SqlConnector
|
2017-08-11 09:50:22 +00:00
|
|
|
|
|
|
|
|
2017-08-12 19:39:29 +00:00
|
|
|
let ctx = getCtx None Auto
|
2017-08-13 13:08:57 +00:00
|
|
|
let chartDownloads extIds = (List.map (fun e -> (series (getDownloads ctx e))) extIds)
|
|
|
|
|> Chart.Line
|
|
|
|
|> Chart.WithOptions (Options(legend=Legend(position="bottom")))
|
|
|
|
|> Chart.WithLabels extIds
|
2017-06-24 21:11:58 +00:00
|
|
|
|
2017-08-06 19:55:24 +00:00
|
|
|
|
2017-08-13 13:08:57 +00:00
|
|
|
chartDownloads (List.take 5 (getAllExtIds ctx))
|
2017-06-24 21:11:58 +00:00
|
|
|
|
2017-06-27 09:54:57 +00:00
|
|
|
let extData =
|
2017-08-12 19:39:29 +00:00
|
|
|
query {for x in ctx.Main.Extension do
|
2017-06-27 09:54:57 +00:00
|
|
|
select (x.Date, x.Name, x.Downloads) }
|
|
|
|
|> Seq.filter (fun (date, name, download) -> date.IsSome && name.IsSome && download.IsSome)
|
|
|
|
|> Seq.map (fun (date, name, download) -> (System.DateTime.Parse(date.Value), name.Value,
|
|
|
|
download.Value))
|
|
|
|
|> Frame.ofRecords
|
|
|
|
|> Frame.indexColsWith ["Date"; "Name"; "Downloads"]
|
|
|
|
|
|
|
|
|