1// NON-CONFIDENTIAL // EXTERNAL 2'use strict'; 3 4 5if (_kcfed == undefined) var _kcfed = {}; 6if (_kcfed.highchartsComponent == undefined) _kcfed.highchartsComponent = {}; 7if (_kcfed.highchartsComponent.functions == undefined) _kcfed.highchartsComponent.functions = {}; 8if (_kcfed.highchartsComponent.vars == undefined) _kcfed.highchartsComponent.vars = {}; 9 10_kcfed.highchartsComponent.vars.containers = []; 11 12(function () { 13 _kcfed.highchartsComponent.functions.init = function () { 14 let containers = document.querySelectorAll('[hc-chart] [hc-chart-container]'); 15 Object.keys(containers).forEach(function (idx) { 16 _kcfed.highchartsComponent.functions.drawChart(containers[idx]); 17 }); 18 } 19 20 _kcfed.highchartsComponent.functions.drawChart = function (container) { 21 let series_json_str = container.getAttribute('hc-series').replace(/'/g, '"'); 22 let x_axis_json_str = container.getAttribute('hc-x-axis').replace(/'/g, '"'); 23 let y_axes_json_str = container.getAttribute('hc-y-axes').replace(/'/g, '"'); 24 let theme_json_str = container.getAttribute('theme').replace(/'/g, '"'); 25 let annotations_json_str = ''; 26 27 let annotations = []; 28 if (container.getAttribute('hc-annotations')) { 29 annotations_json_str = container.getAttribute('hc-annotations').replace(/'/g, '"'); 30 let annoJson = JSON.parse(annotations_json_str); 31 let labels = []; 32 Object.keys(annoJson).forEach(function (idx) { 33 let label = { 34 text: annoJson[idx]["text"], 35 point: { 36 xAxis: 0, 37 yAxis: 0, 38 x: annoJson[idx]["x"], 39 y: annoJson[idx]["y"] 40 }, 41 shape: "rect" 42 } 43 labels.push(label); 44 }); 45 46 annotations = [{ 47 labels: labels, 48 labelOptions: { 49 backgroundColor: "rgba(0, 0, 0, 0.60)" 50 }, 51 draggable: "" 52 }] 53 } 54 55 let theme = JSON.parse(theme_json_str); 56 let series = JSON.parse(series_json_str); 57 let xaxis = JSON.parse(x_axis_json_str); 58 let yaxes = JSON.parse(y_axes_json_str); 59 60 let plot_options = {}; 61 let type = '' 62 let legend_options = {} 63 let responsive_legend_options = {} 64 let tooltip_options = {} 65 66 for (let idx = 0; idx < yaxes.length; idx++) { 67 if (yaxes[idx]["type"].indexOf("stacked") > -1) { 68 let options = {}; 69 if (yaxes[idx]["type"].indexOf("column") > -1) { 70 options["column"] = { 71 stacking: "normal", 72 }; 73 } else if (yaxes[idx]["type"].indexOf("area") > -1) { 74 options["area"] = { 75 stacking: "normal", 76 }; 77 } else if (yaxes[idx]["type"].indexOf("bar") > -1) { 78 options["bar"] = { 79 stacking: "normal", 80 }; 81 } 82 plot_options = options; 83 } else if (yaxes[idx]["type"].indexOf("bubble") > -1) { 84 let options = {}; 85 options["series"] = {}; 86 options["series"]["dataLabels"] = { 87 enabled: true, 88 format: '{point.name}' 89 } 90 plot_options = options; 91 } 92 93 if (yaxes[idx]["type"].indexOf("area") > -1) { 94 if (plot_options["area"] == null) { 95 plot_options["area"] = {}; 96 } 97 plot_options["area"]["lineColor"] = "#F0F0F0"; 98 } 99 100 if (yaxes[idx]["type"].indexOf("bubble") > -1) { 101 legend_options = { 102 enabled: false 103 } 104 responsive_legend_options = { 105 enabled: false 106 } 107 } else { 108 legend_options = {
109 symbolWidth: 50, 110 layout: "horizontal", 111 align: "center", 112 verticalAlign: "bottom", 113 borderWidth: 1, 114 borderRadius: 4, 115 borderColor: "#CCCCCC", 116 itemStyle: { 117 fontSize: "14px", 118 fontWeight: "normal", 119 color: "#333333", 120 }, 121 backgroundColor: "#F0F0F0", 122 padding: 16, 123 margin: 20 124 } 125 responsive_legend_options = { 126 align: "left", 127 verticalAlign: "bottom", 128 layout: "horizontal" 129 } 130 } 131 132 if (yaxes[idx]["type"].indexOf("bubble") > -1) { 133 let x_category = xaxis[idx]['x_category'] 134 let y_category = xaxis[idx]['y_category'] 135 let z_category = xaxis[idx]['z_category'] 136 let tooltip_value = '' 137 if (yaxes[idx]['tooltip']) { 138 tooltip_value = yaxes[idx]['tooltip'] 139 } 140 tooltip_options = { 141 useHTML: true, 142 headerFormat: '<table>', 143 pointFormat: '<tr><th colspan="2"><h3>{point.name}</h3></th></tr>' + 144 '<tr><th>' + x_category + ':</th><td>{point.x}' + tooltip_value + '</td></tr>' + 145 '<tr><th>' + y_category + ':</th><td>{point.y}' + tooltip_value + '</td></tr>' + 146 '<tr><th>' + z_category + ':</th><td>{point.z}' + tooltip_value + '</td></tr>', 147 footerFormat: '</table>', 148 followPointer: true, 149 backgroundColor: "#F0F0F0", 150 borderColor: "#797979", 151 style: { 152 fontSize: "14px", 153 fontWeight: "normal", 154 color: "#333333", 155 }, 156 } 157 } 158 159 type = yaxes[idx]["type"] 160 } 161 162 let description = ""; 163 if (container.getAttribute('hc-description')) { 164 description = container.getAttribute('hc-description').replace(/'/g, '"'); 165 } 166 167 let exportOptions = ["printChart", "separator", "downloadPNG", "downloadJPEG", "downloadPDF", "downloadSVG", "separator", "downloadCSV", "downloadXLS",]; 168 if (container.getAttribute('hc-data-toggle') == "True") { 169 exportOptions = ["printChart", "separator", "downloadPNG", "downloadJPEG", "downloadPDF", "downloadSVG",]; 170 } 171 172 let chart = new Highcharts.Chart({ 173 accessibility: { 174 description: description 175 }, 176 177 credits: { 178 enabled: false 179 }, 180 181 chart: { 182 spacingBottom: 2, 183 height: (9 / 16 * 100) + '%',// 16:9 ratio 184 style: { 185 fontFamily: '"Fira Sans", sans-serif', 186 fontSize: '14px', 187 fontWeight: 'normal', 188 color: '333333' 189 }, 190 type: type, 191 renderTo: container, 192 marginTop: 50, 193 spacing: 0, 194 zoomType: "xy" 195 }, 196 197 title: { 198 text: null 199 }, 200 201 yAxis: yaxes, 202 203 xAxis: xaxis, 204 205 plotOptions: plot_options, 206 207 legend: legend_options, 208 209 series: series, 210 211 annotations: annotations, 212 213 responsive: { 214 chartOptions: { 215 legend: responsive_legend_options, 216 }, 217 rules: [ 218 { 219 condition: { 220 maxWidth: 900 221 } 222 } 223 ] 224 }, 225 226 navigation: { 227 buttonOptions: { 228 symbolStroke: "#017B8E", 229 symbolFill: "#FFFFFF", 230 symbolStrokeWidth: 2.25, 231 theme: { 232 fill: "#FFFFFF", 233 states: { 234 hover: { 235 fill: '#FFFFFF' 236 }, 237 select: { 238 fill: "#FFFFFF" 239 } 240 } 241 } 242 }, 243 menuItemHoverStyle: { 244 background: 'none', 245 color: '#4D4D4D' 246 } 247 }, 248 249 tooltip: tooltip_options, 250 251 exporting: { 252 buttons: { 253 contextButton: { 254 menuItems: exportOptions, 255 symbol: "menu", 256 symbolStroke: "#117FA8", 257 } 258 } 259 }, 260 261 scrollbar: { 262 enabled: false 263 }, 264 265 colors: [theme['FIRST_COLOR'], theme['SECOND_COLOR'], theme['THIRD_COLOR'], theme['FOURTH_COLOR'], theme['FIFTH_COLOR'], theme['SIXTH_COLOR']] 266 }); 267 } 268 269 // Core Event Listeners 270 document.addEventListener('readystatechange', function () { 271 if (event.target.readyState === "complete") { 272 _kcfed.highchartsComponent.functions.init(); 273 } 274 }); 275})()
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.