Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Set certarian color for data */
- const chartData = w.series[0].data
- for (let dataObject of chartData) {
- const value = dataObject.y
- if (value > 17) dataObject.color = 'rgba(255,179,0,1)'
- }
- /* Show select result in chart title */
- const avaliableAppointmentBar = visApi().getWidgetByGuid(w.general.renderTo)
- const avaliableAppointmentBarTitleText = avaliableAppointmentBar.title.text()
- const hospitalSelectorGuid = '1b170162e245491787367870326ead45'
- const hospitalName = visApi().getSelectedValues(hospitalSelectorGuid).lastItem[0]
- avaliableAppointmentBar.title.text(avaliableAppointmentBarTitleText + hospitalName)
- //
- console.clear()
- const colors = {
- red: w.colors[0],
- orange: w.colors[1],
- green: w.colors[2]
- }
- const generalDoctorRegex = /терапевт|педиатр/;
- const generalDoctorEdge = {
- good: 1,
- bad: 3
- }
- const specializedDoctorEdge = {
- good: 14,
- bad: 21
- }
- const targetChart = visApi().getWidgetByGuid(w.general.renderTo)
- const targetChartTitleText = targetChart.title.text()
- const selectorGuid = '4e82a354284345c781cdab282418098b'
- const selectedValue = visApi().getSelectedValues(selectorGuid).lastItem[0]
- // targetChart.title.text(targetChartTitleText + selectedValue)
- console.log(selectedValue)
- const isSatisfyRegex = generalDoctorRegex.test(selectedValue)
- console.log(isSatisfyRegex)
- const doctorEdge = isSatisfyRegex ? generalDoctorEdge : specializedDoctorEdge
- const chartData = w.series[0].data
- for (let dataObject of chartData) {
- const value = dataObject.y
- if (value > doctorEdge.bad) dataObject.color = colors.red
- else if (value <= doctorEdge.good) dataObject.color = colors.green
- else dataObject.color = colors.orange
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement