Skip to content

Commit

Permalink
fix: categories data
Browse files Browse the repository at this point in the history
  • Loading branch information
gitanjli525 committed Sep 23, 2024
1 parent 0e52aee commit 9af5878
Showing 1 changed file with 8 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ open LogicUtils
let getTimeBucket = (json: JSON.t): array<string> => {
json
->getArrayFromJson([])
->Array.map(item => item->getDictFromJsonObject->getString("time_bucket", ""))
->Array.flatMap(item => {
item
->getDictFromJsonObject
->getArrayFromDict("queryData", [])
->Array.map(item => item->getDictFromJsonObject->getString("time_bucket", ""))
})
}

let createData = (json: JSON.t): LineGraphTypes.data => {
Expand All @@ -29,31 +34,8 @@ let createData = (json: JSON.t): LineGraphTypes.data => {

let paymentsSuccessRateMapper = (json: JSON.t): LineGraphTypes.lineGraphPayload => {
open LineGraphTypes
let categories = [
"2024-08-13 18:30:00",
"2024-08-14 18:30:00",
"2024-08-15 18:30:00",
"2024-08-16 18:30:00",
"2024-08-17 18:30:00",
"2024-08-18 18:30:00",
"2024-08-19 18:30:00",
]
// getTimeBucket(json)
let data = [
{
showInLegend: false,
name: "Series 1",
data: [40, 35, 60, 70, 75, 65, 50],
color: "#2f7ed8",
},
{
showInLegend: false,
name: "Series 2",
data: [30, 90, 60, 50, 80, 65, 80],
color: "#2f7ed8",
},
]
// let data = createData(json)
let categories = getTimeBucket(json)
let data = createData(json)
let title = {
text: "Payments Success Rate",
}
Expand Down

0 comments on commit 9af5878

Please sign in to comment.