Commit 59f17f4b authored by Alexandre Delanoë's avatar Alexandre Delanoë

[TYPES Series] Serie -> Series : cleans the uses of Serie.

parent 0747ebfd
...@@ -11,7 +11,7 @@ import Gargantext.Components.Charts.Options.Data (DataN, DataS, DataV) ...@@ -11,7 +11,7 @@ import Gargantext.Components.Charts.Options.Data (DataN, DataS, DataV)
import Gargantext.Components.Charts.Options.Font (IconOptions(..), Shape(..), TextStyle, chartFontStyle, chartFontWeight, icon) import Gargantext.Components.Charts.Options.Font (IconOptions(..), Shape(..), TextStyle, chartFontStyle, chartFontWeight, icon)
import Gargantext.Components.Charts.Options.Legend (legendType, LegendMode(..), PlainOrScroll(..), selectedMode, Orientation(..), orient) import Gargantext.Components.Charts.Options.Legend (legendType, LegendMode(..), PlainOrScroll(..), selectedMode, Orientation(..), orient)
import Gargantext.Components.Charts.Options.Position (Align(..), LeftRelativePosition(..), TopRelativePosition(..), numberPosition, percentPosition, relativePosition) import Gargantext.Components.Charts.Options.Position (Align(..), LeftRelativePosition(..), TopRelativePosition(..), numberPosition, percentPosition, relativePosition)
import Gargantext.Components.Charts.Options.Series (Series(..), SeriesName, SeriesShape(..), seriesType, D1, D2) import Gargantext.Components.Charts.Options.Series (Serie(..), Series(..), toSeries, SeriesName, SeriesShape(..), seriesType, D1, D2)
import Gargantext.Components.Charts.Options.Type (DataZoom, Echarts, Legend, Option, Title, Tooltip, XAxis, YAxis) import Gargantext.Components.Charts.Options.Type (DataZoom, Echarts, Legend, Option, Title, Tooltip, XAxis, YAxis)
import React (unsafeCreateElementDynamic) import React (unsafeCreateElementDynamic)
import React as R import React as R
...@@ -175,7 +175,7 @@ data YAxisFormat = YAxisFormat { position :: String ...@@ -175,7 +175,7 @@ data YAxisFormat = YAxisFormat { position :: String
data Options = Options { mainTitle :: MainTitle data Options = Options { mainTitle :: MainTitle
, subTitle :: SubTitle , subTitle :: SubTitle
, xAxis :: XAxis , xAxis :: XAxis
, yAxis :: Array Series , yAxis :: Array Serie
, yAxisFormat :: YAxisFormat , yAxisFormat :: YAxisFormat
, addZoom :: Boolean , addZoom :: Boolean
} }
...@@ -196,7 +196,7 @@ opts (Options { mainTitle : mainTitle ...@@ -196,7 +196,7 @@ opts (Options { mainTitle : mainTitle
} }
, grid : {containLabel: true} , grid : {containLabel: true}
, xAxis : xs , xAxis : xs
, series : ss , series : map toSeries $ ss
, yAxis : { "type": "value" , yAxis : { "type": "value"
, name: "data" , name: "data"
, min: 0 , min: 0
......
...@@ -45,7 +45,7 @@ seriesType = SeriesType <<< show ...@@ -45,7 +45,7 @@ seriesType = SeriesType <<< show
type Series = {} type Series = {}
data Series' = SeriesD1 D1 | SeriesD2 D2 data Serie = SeriesD1 D1 | SeriesD2 D2
type D1 = type D1 =
{ name :: String { name :: String
...@@ -61,7 +61,7 @@ type D2 = ...@@ -61,7 +61,7 @@ type D2 =
} }
toSeries :: Series' -> Series toSeries :: Serie -> Series
toSeries (SeriesD1 a) = unsafeCoerce a toSeries (SeriesD1 a) = unsafeCoerce a
toSeries (SeriesD2 a) = unsafeCoerce a toSeries (SeriesD2 a) = unsafeCoerce a
......
...@@ -36,7 +36,7 @@ render dispatch _ state _ = [ ...@@ -36,7 +36,7 @@ render dispatch _ state _ = [
, chart scatterEx , chart scatterEx
] ]
where where
myData = [toSeries $ SeriesD1 $ series Bar "Bar Data" [ {name: "val1", value: 50.0} myData = [SeriesD1 $ series Bar "Bar Data" [ {name: "val1", value: 50.0}
, {name: "val2", value: 70.0} , {name: "val2", value: 70.0}
, {name: "val3", value: 80.0} , {name: "val3", value: 80.0}
] ]
...@@ -65,7 +65,7 @@ naturePublis :: Options ...@@ -65,7 +65,7 @@ naturePublis :: Options
naturePublis = Options { mainTitle : "Nature of publications" naturePublis = Options { mainTitle : "Nature of publications"
, subTitle : "Distribution by type" , subTitle : "Distribution by type"
, xAxis : xAxis [] , xAxis : xAxis []
, yAxis : [toSeries $ SeriesD1 $ series Funnel "Funnel Data" naturePublis_y] , yAxis : [SeriesD1 $ series Funnel "Funnel Data" naturePublis_y]
, yAxisFormat : (YAxisFormat { position : "left" , yAxisFormat : (YAxisFormat { position : "left"
, visible : false , visible : false
}) })
...@@ -82,7 +82,7 @@ globalPublis :: Options ...@@ -82,7 +82,7 @@ globalPublis :: Options
globalPublis = (Options { mainTitle : "Global Scientific Publications" globalPublis = (Options { mainTitle : "Global Scientific Publications"
, subTitle : "Distribution of scientific publications by IMT's Schools over time" , subTitle : "Distribution of scientific publications by IMT's Schools over time"
, xAxis : xAxis (map show globalPublis_x) , xAxis : xAxis (map show globalPublis_x)
, yAxis : [toSeries $ SeriesD1 $ series Bar "Number of publication of IMT / year" $ map (\n -> {name: "", value: toNumber n }) globalPublis_y] , yAxis : [SeriesD1 $ series Bar "Number of publication of IMT / year" $ map (\n -> {name: "", value: toNumber n }) globalPublis_y]
, yAxisFormat : (YAxisFormat { position : "left" , yAxisFormat : (YAxisFormat { position : "left"
, visible : true , visible : true
}) })
...@@ -98,7 +98,7 @@ distriBySchool :: Options ...@@ -98,7 +98,7 @@ distriBySchool :: Options
distriBySchool = Options { mainTitle : "School production in 2017" distriBySchool = Options { mainTitle : "School production in 2017"
, subTitle : "Distribution by school" , subTitle : "Distribution by school"
, xAxis : xAxis [] , xAxis : xAxis []
, yAxis : [ toSeries $ SeriesD1 $ series Pie "Pie data" (map (\(Tuple n v) -> {name: n, value: toNumber v}) distriBySchool_y)] , yAxis : [ SeriesD1 $ series Pie "Pie data" (map (\(Tuple n v) -> {name: n, value: toNumber v}) distriBySchool_y)]
, yAxisFormat : (YAxisFormat { position : "" , yAxisFormat : (YAxisFormat { position : ""
, visible : false , visible : false
}) })
...@@ -109,7 +109,7 @@ scatterEx :: Options ...@@ -109,7 +109,7 @@ scatterEx :: Options
scatterEx = Options { mainTitle : "Scatter test" scatterEx = Options { mainTitle : "Scatter test"
, subTitle : "Scatter subtitle" , subTitle : "Scatter subtitle"
, xAxis : xAxis [] , xAxis : xAxis []
, yAxis : [ toSeries $ SeriesD2 $ seriesD2 Scatter 20.0 [[2.0,3.0],[3.0,4.0]]] , yAxis : [ SeriesD2 $ seriesD2 Scatter 20.0 [[2.0,3.0],[3.0,4.0]]]
, yAxisFormat : (YAxisFormat { position : "" , yAxisFormat : (YAxisFormat { position : ""
, visible : true , visible : true
}) })
......
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