Commit e4c4620e authored by Alexandre Delanoë's avatar Alexandre Delanoë

[Chart] Fix xAxis.

parent f92b652c
...@@ -126,7 +126,7 @@ yAxisVoid = yAxis ...@@ -126,7 +126,7 @@ yAxisVoid = yAxis
} }
xAxis' :: Array String -> XAxis xAxis' :: Array String -> XAxis
xAxis' [] = unsafeCoerce {} xAxis' [] = unsafeCoerce {show:false}
xAxis' xs = xAxis xAxis' xs = xAxis
{ "data": xData xs { "data": xData xs
, "type": "category" , "type": "category"
...@@ -140,11 +140,12 @@ xAxis' xs = xAxis ...@@ -140,11 +140,12 @@ xAxis' xs = xAxis
-- TODO try to use Optional -- TODO try to use Optional
yAxis' :: { position :: String yAxis' :: { position :: String
, show :: Boolean , show :: Boolean
, min :: Int
} -> YAxis } -> YAxis
yAxis' {position, show} = yAxis yAxis' {position, show, min} = yAxis
{ "type": "value" { "type": "value"
, name: "data" , name: "data"
, min: 0 , min: min
, axisLabel: {formatter: "{value}"} , axisLabel: {formatter: "{value}"}
, position , position
, show , show
......
...@@ -26,7 +26,7 @@ endConfig = endConfig' V10 ...@@ -26,7 +26,7 @@ endConfig = endConfig' V10
endConfig' :: ApiVersion -> EndConfig endConfig' :: ApiVersion -> EndConfig
endConfig' v = { front : frontRelative endConfig' v = { front : frontRelative
, back : backDemo v } , back : backLocal v }
-- , back : backDemo v } -- , back : backDemo v }
------------------------------------------------------------------------ ------------------------------------------------------------------------
......
...@@ -62,7 +62,7 @@ chartOptions (HistoMetrics { dates: dates', count: count'}) = Options ...@@ -62,7 +62,7 @@ chartOptions (HistoMetrics { dates: dates', count: count'}) = Options
{ mainTitle : "Histogram" { mainTitle : "Histogram"
, subTitle : "Distribution of publications over time" , subTitle : "Distribution of publications over time"
, xAxis : xAxis' dates' , xAxis : xAxis' dates'
, yAxis : yAxis' { position: "left", show: true } , yAxis : yAxis' { position: "left", show: true, min:0}
, series : [seriesBarD1 {name: "Number of publication / year"} $ map (\n -> dataSerie {name: "", value: n, itemStyle : itemStyle {color:grey}}) count'] , series : [seriesBarD1 {name: "Number of publication / year"} $ map (\n -> dataSerie {name: "", value: n, itemStyle : itemStyle {color:grey}}) count']
, addZoom : true , addZoom : true
, tooltip : mkTooltip { formatter: templateFormatter "{b0}" } , tooltip : mkTooltip { formatter: templateFormatter "{b0}" }
......
...@@ -66,8 +66,8 @@ scatterOptions :: Array Metric -> Options ...@@ -66,8 +66,8 @@ scatterOptions :: Array Metric -> Options
scatterOptions metrics = Options scatterOptions metrics = Options
{ mainTitle : "Ngrams Selection Metrics" { mainTitle : "Ngrams Selection Metrics"
, subTitle : "Local metrics (Inc/Exc, Spe/Gen), Global metrics (TFICF maillage)" , subTitle : "Local metrics (Inc/Exc, Spe/Gen), Global metrics (TFICF maillage)"
, xAxis : xAxis { min: 0 } , xAxis : xAxis { min: -1 }
, yAxis : yAxis' { position : "", show: true } , yAxis : yAxis' { position : "", show: true, min : -2}
, series : map2series $ metric2map metrics , series : map2series $ metric2map metrics
, addZoom : false , addZoom : false
, tooltip : mkTooltip { formatter: templateFormatter "{b0}" } , tooltip : mkTooltip { formatter: templateFormatter "{b0}" }
......
...@@ -62,7 +62,7 @@ chartOptions (HistoMetrics { dates: dates', count: count'}) = Options ...@@ -62,7 +62,7 @@ chartOptions (HistoMetrics { dates: dates', count: count'}) = Options
{ mainTitle : "Bar" { mainTitle : "Bar"
, subTitle : "Count of GraphTerm" , subTitle : "Count of GraphTerm"
, xAxis : xAxis' dates' , xAxis : xAxis' dates'
, yAxis : yAxis' { position: "left", show: true } , 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
, tooltip : mkTooltip { formatter: templateFormatter "{b0}" } , tooltip : mkTooltip { formatter: templateFormatter "{b0}" }
...@@ -79,7 +79,7 @@ chartOptionsPie (HistoMetrics { dates: dates', count: count'}) = Options ...@@ -79,7 +79,7 @@ chartOptionsPie (HistoMetrics { dates: dates', count: count'}) = Options
{ mainTitle : "Pie" { mainTitle : "Pie"
, subTitle : "Distribution by GraphTerm" , subTitle : "Distribution by GraphTerm"
, xAxis : xAxis' [] , xAxis : xAxis' []
, yAxis : yAxis' { position: "", show: false } , yAxis : yAxis' { position: "", show: false, min:0}
, series : [seriesPieD1 {name: "Data"} $ map (\(Tuple n v) -> dataSerie {name: n, value:v}) $ zip dates' count'] , series : [seriesPieD1 {name: "Data"} $ map (\(Tuple n v) -> dataSerie {name: n, value:v}) $ zip dates' count']
-- , series : [seriesBarD1 {name: "Number of publication / year"} $ map (\n -> dataSerie {name: "", value: n }) count'] -- , series : [seriesBarD1 {name: "Number of publication / year"} $ map (\n -> dataSerie {name: "", value: n }) count']
, addZoom : false , addZoom : false
......
...@@ -55,7 +55,7 @@ scatterOptions nodes = Options ...@@ -55,7 +55,7 @@ scatterOptions nodes = Options
{ mainTitle : "Tree" { mainTitle : "Tree"
, subTitle : "Tree Sub Title" , subTitle : "Tree Sub Title"
, xAxis : xAxis' [] , xAxis : xAxis' []
, yAxis : yAxis' { position : "", show: false } , yAxis : yAxis' { position : "", show: false, min:0}
, series : [ mkTree TreeMap nodes] , series : [ mkTree TreeMap nodes]
, addZoom : false , addZoom : false
, tooltip : mkTooltip { formatter: templateFormatter "{b0}" } , tooltip : mkTooltip { formatter: templateFormatter "{b0}" }
......
...@@ -42,6 +42,7 @@ render dispatch _ state _ = [ ...@@ -42,6 +42,7 @@ render dispatch _ state _ = [
, xAxis : xAxis' ["2015", "2016", "2017"] , xAxis : xAxis' ["2015", "2016", "2017"]
, yAxis : yAxis' { position: "left" , yAxis : yAxis' { position: "left"
, show: false , show: false
, min : 0
} }
, series : myData , series : myData
, addZoom : false , addZoom : false
...@@ -63,7 +64,7 @@ naturePublis = Options ...@@ -63,7 +64,7 @@ naturePublis = Options
{ mainTitle : "Nature of publications" { mainTitle : "Nature of publications"
, subTitle : "Distribution by type" , subTitle : "Distribution by type"
, xAxis : xAxis' [] , xAxis : xAxis' []
, yAxis : yAxis' { position: "left", show: false } , yAxis : yAxis' { position: "left", show: false, min:0}
, series : [seriesFunnelD1 { name: "Funnel Data" } naturePublis_y] , series : [seriesFunnelD1 { name: "Funnel Data" } naturePublis_y]
, addZoom : false , addZoom : false
, tooltip : tooltipTriggerAxis -- Necessary? , tooltip : tooltipTriggerAxis -- Necessary?
...@@ -82,7 +83,7 @@ globalPublis = Options ...@@ -82,7 +83,7 @@ globalPublis = Options
{ mainTitle : "Histogram" { mainTitle : "Histogram"
, subTitle : "Distribution of publications over time" , subTitle : "Distribution of publications over time"
, xAxis : xAxis' (map show globalPublis_x) , xAxis : xAxis' (map show globalPublis_x)
, yAxis : yAxis' { position: "left", show: true } , yAxis : yAxis' { position: "left", show: true, min:0}
, series : [seriesBarD1 {name: "Number of publication / year"} $ map (\n -> dataSerie {name: "", value: toNumber n }) globalPublis_y] , series : [seriesBarD1 {name: "Number of publication / year"} $ map (\n -> dataSerie {name: "", value: toNumber n }) globalPublis_y]
, addZoom : true , addZoom : true
, tooltip : tooltipTriggerAxis -- Necessary? , tooltip : tooltipTriggerAxis -- Necessary?
...@@ -99,7 +100,7 @@ distriBySchool = Options ...@@ -99,7 +100,7 @@ distriBySchool = Options
{ mainTitle : "School production in 2017" { mainTitle : "School production in 2017"
, subTitle : "Distribution by school" , subTitle : "Distribution by school"
, xAxis : xAxis' [] , xAxis : xAxis' []
, yAxis : yAxis' { position : "", show: false } , yAxis : yAxis' { position : "", show: false, min:0}
, series : [ seriesPieD1 {name: "Pie data"} (map (\(Tuple n v) -> dataSerie {name: n, value: toNumber v}) distriBySchool_y)] , series : [ seriesPieD1 {name: "Pie data"} (map (\(Tuple n v) -> dataSerie {name: n, value: toNumber v}) distriBySchool_y)]
, addZoom : false , addZoom : false
, tooltip : tooltipTriggerAxis -- Necessary? , tooltip : tooltipTriggerAxis -- Necessary?
...@@ -110,7 +111,7 @@ scatterEx = Options ...@@ -110,7 +111,7 @@ scatterEx = Options
{ mainTitle : "Scatter test" { mainTitle : "Scatter test"
, subTitle : "Scatter subtitle" , subTitle : "Scatter subtitle"
, xAxis : xAxis' [] , xAxis : xAxis' []
, yAxis : yAxis' { position: "", show: true } , yAxis : yAxis' { position: "", show: true, min:0}
, series : [ seriesScatterD2 {name: "name1", symbolSize: 10.0} (dataSerieV <$> [[2.0,3.0],[3.0,4.0]]) , series : [ seriesScatterD2 {name: "name1", symbolSize: 10.0} (dataSerieV <$> [[2.0,3.0],[3.0,4.0]])
, seriesScatterD2 {name: "name2", symbolSize: 5.0 } (dataSerieV <$> [[1.0,3.0],[5.0,4.0]]) , seriesScatterD2 {name: "name2", symbolSize: 5.0 } (dataSerieV <$> [[1.0,3.0],[5.0,4.0]])
, seriesScatterD2 {name: "name3", symbolSize: 10.0} (dataSerieV <$> [[10.0,3.0],[8.0,4.0]]) , seriesScatterD2 {name: "name3", symbolSize: 10.0} (dataSerieV <$> [[10.0,3.0],[8.0,4.0]])
...@@ -124,7 +125,7 @@ sankeyEx = Options ...@@ -124,7 +125,7 @@ sankeyEx = Options
{ mainTitle : "" { mainTitle : ""
, subTitle : "" , subTitle : ""
, xAxis : xAxis' [] , xAxis : xAxis' []
, yAxis : yAxis' { position: "", show: false } , yAxis : yAxis' { position: "", show: false, min:0}
, series : , series :
[ seriesSankey [ seriesSankey
{ "data": { "data":
...@@ -193,7 +194,7 @@ treeMapEx = Options ...@@ -193,7 +194,7 @@ treeMapEx = Options
{ mainTitle : "" { mainTitle : ""
, subTitle : "" , subTitle : ""
, xAxis : xAxis' [] , xAxis : xAxis' []
, yAxis : yAxis' { position: "", show: false } , yAxis : yAxis' { position: "", show: false, min:0}
, series : [mkTree TreeMap treeData] , series : [mkTree TreeMap treeData]
, addZoom : false , addZoom : false
, tooltip : tooltipTriggerAxis -- Necessary? , tooltip : tooltipTriggerAxis -- Necessary?
...@@ -204,7 +205,7 @@ treeEx = Options ...@@ -204,7 +205,7 @@ treeEx = Options
{ mainTitle : "Tree" { mainTitle : "Tree"
, subTitle : "Radial" , subTitle : "Radial"
, xAxis : xAxis' [] , xAxis : xAxis' []
, yAxis : yAxis' { position: "", show: false } , yAxis : yAxis' { position: "", show: false, min:0}
, series : [mkTree TreeRadial treeData'] , series : [mkTree TreeRadial treeData']
, addZoom : false , addZoom : false
, tooltip : tooltipTriggerAxis -- Necessary? , tooltip : tooltipTriggerAxis -- Necessary?
......
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