1 {-# LANGUAGE DeriveGeneric #-}
2 {-# LANGUAGE FlexibleContexts #-}
3 {-# LANGUAGE NoImplicitPrelude #-}
4 {-# LANGUAGE OverloadedStrings #-}
5 {-# LANGUAGE RankNTypes #-}
6 {-# LANGUAGE TemplateHaskell #-}
8 module Gargantext.Viz.Types where
10 import Data.Aeson.TH (deriveJSON)
12 import Data.Text (Text)
13 import GHC.Generics (Generic)
15 import Test.QuickCheck (elements)
16 import Test.QuickCheck.Arbitrary (Arbitrary, arbitrary)
18 import Gargantext.Core.Utils.Prefix (unPrefix, unPrefixSwagger)
24 data Chart = ChartHisto | ChartScatter | ChartPie
28 data Histo = Histo { histo_dates :: ![Text]
29 , histo_count :: ![Int]
31 deriving (Show, Generic)
33 instance ToSchema Histo where
34 declareNamedSchema = genericDeclareNamedSchema (unPrefixSwagger "histo_")
35 instance Arbitrary Histo
37 arbitrary = elements [ Histo ["2012"] [1]
40 deriveJSON (unPrefix "histo_") ''Histo