Advertisement
whoisYeshua

Visiology - polymedia

Oct 15th, 2021 (edited)
857
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Set certarian color for data */
  2. const chartData = w.series[0].data
  3. for (let dataObject of chartData) {
  4.     const value = dataObject.y
  5.     if (value > 17) dataObject.color = 'rgba(255,179,0,1)'
  6. }
  7.  
  8. /* Show select result in chart title */
  9. const avaliableAppointmentBar = visApi().getWidgetByGuid(w.general.renderTo)
  10. const avaliableAppointmentBarTitleText = avaliableAppointmentBar.title.text()
  11.  
  12. const hospitalSelectorGuid = '1b170162e245491787367870326ead45'
  13. const hospitalName = visApi().getSelectedValues(hospitalSelectorGuid).lastItem[0]
  14.  
  15. avaliableAppointmentBar.title.text(avaliableAppointmentBarTitleText + hospitalName)
  16.  
  17. //
  18. console.clear()
  19.  
  20. const colors = {
  21.     red: w.colors[0],
  22.     orange: w.colors[1],
  23.     green: w.colors[2]
  24. }
  25.  
  26. const generalDoctorRegex = /терапевт|педиатр/;
  27. const generalDoctorEdge = {
  28.     good: 1,
  29.     bad: 3
  30. }
  31. const specializedDoctorEdge = {
  32.     good: 14,
  33.     bad: 21
  34. }
  35.  
  36. const targetChart = visApi().getWidgetByGuid(w.general.renderTo)
  37. const targetChartTitleText = targetChart.title.text()
  38.  
  39. const selectorGuid = '4e82a354284345c781cdab282418098b'
  40. const selectedValue = visApi().getSelectedValues(selectorGuid).lastItem[0]
  41.  
  42. //  targetChart.title.text(targetChartTitleText + selectedValue)
  43.  
  44. console.log(selectedValue)
  45. const isSatisfyRegex = generalDoctorRegex.test(selectedValue)
  46. console.log(isSatisfyRegex)
  47.  
  48. const doctorEdge = isSatisfyRegex ? generalDoctorEdge : specializedDoctorEdge
  49.  
  50. const chartData = w.series[0].data
  51. for (let dataObject of chartData) {
  52.     const value = dataObject.y
  53.    
  54.     if (value > doctorEdge.bad) dataObject.color = colors.red
  55.     else if (value <= doctorEdge.good) dataObject.color = colors.green
  56.     else dataObject.color = colors.orange
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement