-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/391 user journey segment page lib per page (#392)
* [#391] Move enableEditCase state into general CaseUIState * [#391] Initial layout for EnterIncomeData visual * [#391] Add income target card on EnterIncomeData page * [#391] Create VisualCardWrapper component * [#391] Render household income bar chart * [#391] Init UnderstandIncomeGap page * [#391] Create visuals component * [#391] Fetch questions on wrapper * [#391] Create dashboardData state * [#391] Render ChartIncomeGap * [#391] Create CompareIncomeGap visualization * [#391] Handle new user journey when prev case doesn't have any segments yet * [#391] Debugging with test full case data for current complete new user journey * [#391] Fix EnterIncomeData page onLoad & onValuesChange * [#391] Refine EnterIncomeData calculation * [#391] Handle enableEditCase state * [#391] Fix EnterIncomeData value & dashboardData calculation * [#391] Add answers & benchmark into segment put endpoint obj * [#391] Create ChartExploreIncomeDriversBreakdown * [#393] Initial AssessImpactMitigationStrategies page * [#391] Create biggest impact on income & monetary contribution chart * [#393] Initial binning driver form * [#393] Set sensitivity analysis value into state
- Loading branch information
1 parent
92840c9
commit 282ab33
Showing
37 changed files
with
2,962 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
import { isEmpty } from "lodash"; | ||
import { | ||
Legend, | ||
TextStyle, | ||
AxisLabelFormatter, | ||
LabelStyle, | ||
incomeTargetChartOption, | ||
Color, | ||
backgroundColor, | ||
Easing, | ||
NoData, | ||
formatNumberToString, | ||
thousandFormatter, | ||
} from "../options/common"; | ||
|
||
export const getColumnStackBarOptions = ({ | ||
xAxis = { name: "", axisLabel: {} }, | ||
yAxis = { name: "", min: 0, max: 0 }, | ||
origin = [], | ||
series = [], | ||
showLabel = false, | ||
grid = {}, | ||
}) => { | ||
if (isEmpty(series) || !series) { | ||
return NoData; | ||
} | ||
|
||
const legends = series.map((x) => ({ | ||
name: x.name, | ||
icon: x?.symbol || "circle", | ||
})); | ||
const xAxisData = origin.map((x) => x.name); | ||
|
||
const options = { | ||
legend: { | ||
...Legend, | ||
data: legends, | ||
top: 15, | ||
left: "right", | ||
orient: "vertical", | ||
}, | ||
tooltip: { | ||
trigger: "axis", | ||
axisPointer: { | ||
type: "shadow", | ||
}, | ||
formatter: function (params) { | ||
let res = "<div>"; | ||
res += "<b>" + params[0].axisValueLabel + "</b>"; | ||
res += "<ul style='list-style-type: none; margin: 0; padding: 0;'>"; | ||
params.forEach((param) => { | ||
res += "<li>"; | ||
res += "<span>"; | ||
res += param.marker; | ||
res += param.seriesName; | ||
res += "</span>"; | ||
res += | ||
"<b style='float: right; margin-left: 12px;'>" + | ||
thousandFormatter(param.value) + | ||
"</b>"; | ||
res += "</li>"; | ||
}); | ||
res += "</ul>"; | ||
res += "</div>"; | ||
return res; | ||
}, | ||
backgroundColor: "#ffffff", | ||
...TextStyle, | ||
}, | ||
grid: { | ||
top: grid?.top ? grid.top : 25, | ||
left: grid?.left ? grid.left : 50, | ||
right: grid?.right ? grid.right : 190, | ||
bottom: grid?.bottom ? grid.bottom : 25, | ||
show: true, | ||
containLabel: true, | ||
label: { | ||
color: "#222", | ||
...TextStyle, | ||
}, | ||
}, | ||
xAxis: { | ||
...xAxis, | ||
nameTextStyle: { ...TextStyle }, | ||
nameLocation: "middle", | ||
nameGap: 50, | ||
boundaryGap: true, | ||
type: "category", | ||
data: xAxisData, | ||
axisLabel: { | ||
width: 100, | ||
interval: 0, | ||
overflow: "break", | ||
...TextStyle, | ||
color: "#4b4b4e", | ||
formatter: AxisLabelFormatter?.formatter, | ||
...xAxis.axisLabel, | ||
}, | ||
axisTick: { | ||
alignWithLabel: true, | ||
}, | ||
}, | ||
yAxis: { | ||
...yAxis, | ||
type: "value", | ||
nameTextStyle: { ...TextStyle }, | ||
nameLocation: "middle", | ||
nameGap: 75, | ||
axisLabel: { | ||
formatter: function (value) { | ||
return formatNumberToString(value); | ||
}, | ||
...TextStyle, | ||
color: "#9292ab", | ||
}, | ||
}, | ||
series: series.map((s) => { | ||
s = { | ||
...s, | ||
barMaxWidth: 50, | ||
emphasis: { | ||
focus: "series", | ||
}, | ||
}; | ||
if (s.type === "line") { | ||
return { ...incomeTargetChartOption, ...s }; | ||
} | ||
return { | ||
...s, | ||
label: { | ||
...LabelStyle.label, | ||
show: showLabel, | ||
position: "inside", | ||
}, | ||
}; | ||
}), | ||
...Color, | ||
...backgroundColor, | ||
...Easing, | ||
}; | ||
return options; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.