2 Module : Gargantext.Viz.Chart
3 Description : Graph utils
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
12 {-# LANGUAGE NoImplicitPrelude #-}
13 {-# LANGUAGE TemplateHaskell #-}
14 {-# LANGUAGE DeriveGeneric #-}
15 {-# LANGUAGE RankNTypes #-}
17 module Gargantext.Viz.Chart
21 import Data.Text (Text)
22 import Data.List (unzip, sortOn)
23 import Data.Map (toList)
24 import GHC.Generics (Generic)
25 import Gargantext.Prelude
26 import Gargantext.Database.Schema.NodeNode (selectDocsDates)
27 import Gargantext.Database.Utils
28 import Gargantext.Database.Types.Node (CorpusId)
29 import Gargantext.Text.Metrics.Count (occurrencesWith)
32 data Chart = ChartHisto | ChartScatter | ChartPie
36 data Histo = Histo { histo_dates :: [Text]
37 , histo_count :: [Int]
41 histoData :: CorpusId -> Cmd err Histo
43 dates <- selectDocsDates cId
47 $ occurrencesWith identity dates