Commit 70de2df8 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'dev' of...

Merge branch 'dev' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into feature/search-input-component
parents 72c59b5a bd8a048d
......@@ -11,10 +11,10 @@ type DataLegend =
, textStyle :: TextStyle
}
type DataAxis =
{ value :: String
type DataAxis = Array String
{- value :: String
, textStyle :: TextStyle
}
-}
type RequiredData v o =
{ value :: v
......
......@@ -2,6 +2,7 @@ module Gargantext.Components.Charts.Options.ECharts where
import Prelude
import Data.String (take)
import CSS (italic)
import CSS.Common (normal)
import Data.Array (length)
......@@ -128,14 +129,12 @@ yAxisVoid = yAxis
xAxis' :: Array String -> XAxis
xAxis' [] = unsafeCoerce {show:false}
xAxis' xs = xAxis
{ "data": xData xs
{ "data": xs
, "type": "category"
, axisTick: {alignWithLabel: true}
, show: true
, axisLabel: {formatter: "{value}"}
}
where
xData :: Array String -> Array DataAxis
xData = map (\x -> {value : x, textStyle : textStyle})
-- TODO try to use Optional
yAxis' :: { position :: String
......@@ -144,7 +143,7 @@ yAxis' :: { position :: String
} -> YAxis
yAxis' {position, show, min} = yAxis
{ "type": "value"
, name: "data"
, name: ""
, min: min
, axisLabel: {formatter: "{value}"}
, position
......@@ -258,10 +257,10 @@ textStyle =
, fontStyle: chartFontStyle normal
, fontWeight: chartFontWeight normal
, fontFamily: "sans-serif"
, fontSize: 15
, fontSize: 10
, align: relativePosition $ Relative LeftPos
, verticalAlign: relativePosition $ Relative Top
, lineHeight: percentPosition 0.0
, lineHeight: percentPosition 10.0
, width: percentPosition 100.0
, height: percentPosition 100.0
, textBorderColor: black
......
......@@ -128,7 +128,7 @@ type AxisTick =
data XAxis
type XAxisOptional =
( "data" :: Array DataAxis
( "data" :: Array String -- DataAxis
, "type" :: String
, axisTick :: AxisTick
, name :: String
......
......@@ -246,6 +246,8 @@ loadPage {nodeId, tabType, listId, params: {limit, offset, orderBy}} = do
convOrderBy (T.DESC (T.ColumnName "Date")) = DateDesc
convOrderBy (T.ASC (T.ColumnName "Title")) = TitleAsc
convOrderBy (T.DESC (T.ColumnName "Title")) = TitleDesc
convOrderBy (T.ASC (T.ColumnName "Source")) = SourceAsc
convOrderBy (T.DESC (T.ColumnName "Source")) = SourceDesc
convOrderBy _ = DateAsc -- TODO
......
......@@ -318,6 +318,8 @@ loadPage {nodeId, query, params: {limit, offset, orderBy}} = do
convOrderBy (T.DESC (T.ColumnName "Date")) = DateDesc
convOrderBy (T.ASC (T.ColumnName "Title")) = TitleAsc
convOrderBy (T.DESC (T.ColumnName "Title")) = TitleDesc
convOrderBy (T.ASC (T.ColumnName "Source")) = SourceAsc
convOrderBy (T.DESC (T.ColumnName "Source")) = SourceDesc
convOrderBy _ = DateAsc -- TODO
......
......@@ -153,8 +153,8 @@ tableSpec = simpleSpec performAction render
cs :: Array ReactElement
cs =
case currentOrderBy of
Just (ASC d) | c == d -> [lnk (Just (DESC c)) "ASC ", lnk Nothing (columnName c)]
Just (DESC d) | c == d -> [lnk (Just (ASC c)) "DESC ", lnk Nothing (columnName c)]
Just (ASC d) | c == d -> [lnk (Just (DESC c)) "DESC ", lnk Nothing (columnName c)]
Just (DESC d) | c == d -> [lnk (Just (ASC c)) "ASC ", lnk Nothing (columnName c)]
_ -> [lnk (Just (ASC c)) (columnName c)]
render :: Render State Props Action
......
......@@ -321,6 +321,7 @@ data OrderBy = DateAsc | DateDesc
| TitleAsc | TitleDesc
| ScoreAsc | ScoreDesc
| TermAsc | TermDesc
| SourceAsc | SourceDesc
derive instance genericOrderBy :: Generic OrderBy _
......
module Gargantext.Pages.Corpus.Chart.Pie where
import Data.Array (foldl, zip)
import Data.String (take, joinWith, Pattern(..), split, length)
import Data.Array (foldl, zip, filter)
import Data.Array as A
import Data.Tuple (Tuple(..))
import Data.Map as Map
import Data.Int (toNumber)
......@@ -61,7 +63,7 @@ chartOptions :: HistoMetrics -> Options
chartOptions (HistoMetrics { dates: dates', count: count'}) = Options
{ mainTitle : "Bar"
, subTitle : "Count of GraphTerm"
, xAxis : xAxis' dates'
, xAxis : xAxis' $ map (\t -> joinWith " " $ map (take 3) $ A.take 3 $ filter (\s -> length s > 3) $ split (Pattern " ") t) dates'
, yAxis : yAxis' { position: "left", show: true, min:0}
, series : [seriesBarD1 {name: "Number of publication / year"} $ map (\n -> dataSerie {name: "", itemStyle: itemStyle {color:blue}, value: n }) count']
, addZoom : false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment