From 7341ed0e2b39075795f92351e580076d9420e317 Mon Sep 17 00:00:00 2001 From: gitanjli525 Date: Tue, 24 Sep 2024 15:56:11 +0530 Subject: [PATCH] feat: bar graph entity --- .../Graphs/BarGraph/BarGraphTypes.res | 22 ++++++++++++------- .../Graphs/BarGraph/BarGraphUtils.res | 15 ++++++++----- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/screens/NewAnalytics/Graphs/BarGraph/BarGraphTypes.res b/src/screens/NewAnalytics/Graphs/BarGraph/BarGraphTypes.res index b4b9b85fc..b6cfe1cff 100644 --- a/src/screens/NewAnalytics/Graphs/BarGraph/BarGraphTypes.res +++ b/src/screens/NewAnalytics/Graphs/BarGraph/BarGraphTypes.res @@ -3,8 +3,6 @@ type spacingLeft = int type spacingRight = int type categories = array -type crosshair = bool -type barWidth = int type align = string type color = string type gridLineWidth = int @@ -13,7 +11,10 @@ type gridLineDashStyle = string type tickmarkPlacement = string type endOnTick = bool type startOnTick = bool +type tickInterval = int +type tickWidth = int type min = int +type max = int type showInLegend = bool type name = string @@ -29,7 +30,8 @@ type exporting = { type marker = { ...enabled, } -type bar = {marker: marker} +type pointPadding = float +type bar = {marker: marker, pointPadding: pointPadding} type plotOptions = {bar: bar} type labels = { align: align, @@ -55,18 +57,22 @@ type yAxis = { gridLineWidth: gridLineWidth, gridLineColor: gridLineColor, gridLineDashStyle: gridLineDashStyle, - tickmarkPlacement: tickmarkPlacement, - endOnTick: endOnTick, - startOnTick: startOnTick, + tickInterval: tickInterval, min: min, + max: max, } type xAxis = { categories: categories, - crosshair: crosshair, - barWidth: barWidth, labels: labels, + tickWidth: tickWidth, + tickmarkPlacement: tickmarkPlacement, + endOnTick: endOnTick, + startOnTick: startOnTick, gridLineDashStyle: gridLineDashStyle, + gridLineWidth: gridLineWidth, + gridLineColor: gridLineColor, + min: min, } type barGraphOptions = { diff --git a/src/screens/NewAnalytics/Graphs/BarGraph/BarGraphUtils.res b/src/screens/NewAnalytics/Graphs/BarGraph/BarGraphUtils.res index ce74b234c..e8ead8649 100644 --- a/src/screens/NewAnalytics/Graphs/BarGraph/BarGraphUtils.res +++ b/src/screens/NewAnalytics/Graphs/BarGraph/BarGraphUtils.res @@ -12,31 +12,36 @@ let getBarGraphOptions = (barGraphOptions: barGraphPayload) => { }, xAxis: { categories, - crosshair: true, - barWidth: 1, labels: { align: "center", style: { color: "#999", }, }, + tickWidth: 1, + tickmarkPlacement: "on", + endOnTick: false, + startOnTick: false, gridLineDashStyle: "Dash", + gridLineWidth: 1, + gridLineColor: "#e6e6e6", + min: 0, }, yAxis: { title, gridLineWidth: 1, gridLineColor: "#e6e6e6", gridLineDashStyle: "Solid", - tickmarkPlacement: "on", - endOnTick: false, - startOnTick: false, + tickInterval: 25, min: 0, + max: 100, }, plotOptions: { bar: { marker: { enabled: false, }, + pointPadding: 0.2, }, }, series: data,