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 = ...@@ -11,10 +11,10 @@ type DataLegend =
, textStyle :: TextStyle , textStyle :: TextStyle
} }
type DataAxis = type DataAxis = Array String
{ value :: String {- value :: String
, textStyle :: TextStyle , textStyle :: TextStyle
} -}
type RequiredData v o = type RequiredData v o =
{ value :: v { value :: v
......
...@@ -2,6 +2,7 @@ module Gargantext.Components.Charts.Options.ECharts where ...@@ -2,6 +2,7 @@ module Gargantext.Components.Charts.Options.ECharts where
import Prelude import Prelude
import Data.String (take)
import CSS (italic) import CSS (italic)
import CSS.Common (normal) import CSS.Common (normal)
import Data.Array (length) import Data.Array (length)
...@@ -128,14 +129,12 @@ yAxisVoid = yAxis ...@@ -128,14 +129,12 @@ yAxisVoid = yAxis
xAxis' :: Array String -> XAxis xAxis' :: Array String -> XAxis
xAxis' [] = unsafeCoerce {show:false} xAxis' [] = unsafeCoerce {show:false}
xAxis' xs = xAxis xAxis' xs = xAxis
{ "data": xData xs { "data": xs
, "type": "category" , "type": "category"
, axisTick: {alignWithLabel: true} , axisTick: {alignWithLabel: true}
, show: true , show: true
, axisLabel: {formatter: "{value}"}
} }
where
xData :: Array String -> Array DataAxis
xData = map (\x -> {value : x, textStyle : textStyle})
-- TODO try to use Optional -- TODO try to use Optional
yAxis' :: { position :: String yAxis' :: { position :: String
...@@ -144,7 +143,7 @@ yAxis' :: { position :: String ...@@ -144,7 +143,7 @@ yAxis' :: { position :: String
} -> YAxis } -> YAxis
yAxis' {position, show, min} = yAxis yAxis' {position, show, min} = yAxis
{ "type": "value" { "type": "value"
, name: "data" , name: ""
, min: min , min: min
, axisLabel: {formatter: "{value}"} , axisLabel: {formatter: "{value}"}
, position , position
...@@ -258,10 +257,10 @@ textStyle = ...@@ -258,10 +257,10 @@ textStyle =
, fontStyle: chartFontStyle normal , fontStyle: chartFontStyle normal
, fontWeight: chartFontWeight normal , fontWeight: chartFontWeight normal
, fontFamily: "sans-serif" , fontFamily: "sans-serif"
, fontSize: 15 , fontSize: 10
, align: relativePosition $ Relative LeftPos , align: relativePosition $ Relative LeftPos
, verticalAlign: relativePosition $ Relative Top , verticalAlign: relativePosition $ Relative Top
, lineHeight: percentPosition 0.0 , lineHeight: percentPosition 10.0
, width: percentPosition 100.0 , width: percentPosition 100.0
, height: percentPosition 100.0 , height: percentPosition 100.0
, textBorderColor: black , textBorderColor: black
......
...@@ -128,7 +128,7 @@ type AxisTick = ...@@ -128,7 +128,7 @@ type AxisTick =
data XAxis data XAxis
type XAxisOptional = type XAxisOptional =
( "data" :: Array DataAxis ( "data" :: Array String -- DataAxis
, "type" :: String , "type" :: String
, axisTick :: AxisTick , axisTick :: AxisTick
, name :: String , name :: String
......
...@@ -246,6 +246,8 @@ loadPage {nodeId, tabType, listId, params: {limit, offset, orderBy}} = do ...@@ -246,6 +246,8 @@ loadPage {nodeId, tabType, listId, params: {limit, offset, orderBy}} = do
convOrderBy (T.DESC (T.ColumnName "Date")) = DateDesc convOrderBy (T.DESC (T.ColumnName "Date")) = DateDesc
convOrderBy (T.ASC (T.ColumnName "Title")) = TitleAsc convOrderBy (T.ASC (T.ColumnName "Title")) = TitleAsc
convOrderBy (T.DESC (T.ColumnName "Title")) = TitleDesc convOrderBy (T.DESC (T.ColumnName "Title")) = TitleDesc
convOrderBy (T.ASC (T.ColumnName "Source")) = SourceAsc
convOrderBy (T.DESC (T.ColumnName "Source")) = SourceDesc
convOrderBy _ = DateAsc -- TODO convOrderBy _ = DateAsc -- TODO
......
...@@ -318,6 +318,8 @@ loadPage {nodeId, query, params: {limit, offset, orderBy}} = do ...@@ -318,6 +318,8 @@ loadPage {nodeId, query, params: {limit, offset, orderBy}} = do
convOrderBy (T.DESC (T.ColumnName "Date")) = DateDesc convOrderBy (T.DESC (T.ColumnName "Date")) = DateDesc
convOrderBy (T.ASC (T.ColumnName "Title")) = TitleAsc convOrderBy (T.ASC (T.ColumnName "Title")) = TitleAsc
convOrderBy (T.DESC (T.ColumnName "Title")) = TitleDesc convOrderBy (T.DESC (T.ColumnName "Title")) = TitleDesc
convOrderBy (T.ASC (T.ColumnName "Source")) = SourceAsc
convOrderBy (T.DESC (T.ColumnName "Source")) = SourceDesc
convOrderBy _ = DateAsc -- TODO convOrderBy _ = DateAsc -- TODO
......
...@@ -153,8 +153,8 @@ tableSpec = simpleSpec performAction render ...@@ -153,8 +153,8 @@ tableSpec = simpleSpec performAction render
cs :: Array ReactElement cs :: Array ReactElement
cs = cs =
case currentOrderBy of case currentOrderBy of
Just (ASC d) | c == d -> [lnk (Just (DESC c)) "ASC ", 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)) "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)] _ -> [lnk (Just (ASC c)) (columnName c)]
render :: Render State Props Action render :: Render State Props Action
......
...@@ -321,6 +321,7 @@ data OrderBy = DateAsc | DateDesc ...@@ -321,6 +321,7 @@ data OrderBy = DateAsc | DateDesc
| TitleAsc | TitleDesc | TitleAsc | TitleDesc
| ScoreAsc | ScoreDesc | ScoreAsc | ScoreDesc
| TermAsc | TermDesc | TermAsc | TermDesc
| SourceAsc | SourceDesc
derive instance genericOrderBy :: Generic OrderBy _ derive instance genericOrderBy :: Generic OrderBy _
......
module Gargantext.Pages.Corpus.Chart.Pie where 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.Tuple (Tuple(..))
import Data.Map as Map import Data.Map as Map
import Data.Int (toNumber) import Data.Int (toNumber)
...@@ -61,7 +63,7 @@ chartOptions :: HistoMetrics -> Options ...@@ -61,7 +63,7 @@ chartOptions :: HistoMetrics -> Options
chartOptions (HistoMetrics { dates: dates', count: count'}) = Options chartOptions (HistoMetrics { dates: dates', count: count'}) = Options
{ mainTitle : "Bar" { mainTitle : "Bar"
, subTitle : "Count of GraphTerm" , 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} , 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'] , series : [seriesBarD1 {name: "Number of publication / year"} $ map (\n -> dataSerie {name: "", itemStyle: itemStyle {color:blue}, value: n }) count']
, addZoom : false , 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