1if(!configured) 2{ 3 throw new Error('/js/utf-8/configGraph.js is not imported'); 4} 5 6var aDataQuote = []; 7var aDataDisplayed = []; 8var maxBound = 0; 9var minBound = 0; 10 11function sortByX(a,b){ 12 if (a.x < b.x) 13 return -1; 14 else if (a.x > b.x) 15 return 1; 16 else return 0; 17} 18 19function loadMoreNews(codeZB,inDiv,sFilter) 20{ 21 var type="news"; 22 if(sFilter=="dividendes") 23 type="dividendes"; 24 25 $("#moreNewsButton").prop('disabled', true); 26 $.ajax({url : URL_SERVEUR+'atDataFeed.php', 27 cache: false, 28 context : document.body, 29 async : true, 30 data : {codeZB : codeZB, type : type, sFilter : sFilter}, 31 type : 'GET', 32 33 success : function(data){ 34 handleDataNews(data,inDiv,sFilter); 35 }}); 36} 37 38function loadNewsFromDate(codeZB,fromDate,inDiv) 39{ 40 41 $("#moreNewsButton").prop('disabled', true); 42 $.ajax({url : URL_SERVEUR+'atDataFeed.php', 43 cache: false, 44 context : document.body, 45 async : true, 46 data : {codeZB : codeZB, type : "news", datemin: fromDate}, 47 type : 'GET', 48 success : function(data){ 49 handleDataNews(data,inDiv); 50 }}); 51} 52 53function handleDataNews(data,inDiv,sFilter) 54{ 55 sFilter = (typeof sFilter === "undefined") ? "" : sFilter; 56 57 var aNews; 58 try{ 59 aNews = JSON.parse(data); 60 } 61 catch(e){ 62 console.log(e); 63 console.log(data); 64 return; 65 } 66 67 var chart = $("#"+inDiv+"").highcharts(); 68 69 var aValidSource = []; 70 71 if(sFilter=="") 72 { 73 if(aNews.length>200) 74 aValidSource = ((window.location.host).indexOf("zonebourse")>=0) ? ["dow_jones","reuters","reuters_pro","zonebourse","cercle","awp","dpa_afx","zonebourse_dpa","mtnewswires","mtnewswires_zonebourse","capital_iq"] : ["dow_jones","reuters","reuters_pro","zonebourse","noodls","prnewswire","businesswire","globenewswire","companynews","fxcm","marketwired","newsfilecorp","awp","dpa_afx","zonebourse_dpa","mtnewswires","mtnewswires_zonebourse","capital_iq"]; 75 else if(aNews.length>100) 76 aValidSource = ((window.location.host).indexOf("zonebourse")>=0) ? ["dow_jones","reuters","reuters_pro","zonebourse","optionfinance","prnewswire","businesswire","globenewswire","companynews","fxcm","marketwired","newsfilecorp","nyfp","tensid","awp","dpa_afx","zonebourse_dpa","mtnewswires","mtnewswires_zonebourse","capital_iq"] : ["dow_jones","reuters","reuters_pro","zonebourse","noodls","prnewswire","businesswire","globenewswire","companynews","fxcm","marketwired","newsfilecorp","nyfp","tensid","awp","dpa_afx","zonebourse_dpa","mtnewswires","mtnewswires_zonebourse","capital_iq"]; 77 78 if(sFilter=='agenda' || sFilter=='agenda_hot' || sFilter=='dividendes') 79 aValidSource = []; 80 } 81 82 var id = 'newsSeries'; 83 var iZIndex = 1; 84 85 86 if(sFilter=='agenda_hot') 87 id = 'newsSeriesAgendaHot'; 88 89 if(sFilter=='dividendes') 90 id = 'newsSeriesDividendes'; 91 92 if(sFilter=='consensus') 93 id = 'newsSeriesConsensus'; 94 95 96 var sFillColor = '#FFEE00'; 97 var sShape = 'circlepin'; 98 var ilegendIndex = 1; 99 var sColor = 'black'; 100 var sWidth = 14; 101 var sHeight = 14; 102 103 if(sFilter=='agenda') 104 { 105 sFillColor = 'white'; 106 sShape = 'circlepin'; 107 ilegendIndex = 3; 108 sColor = '#004EFF'; 109 sWidth = 6; 110 sHeight = 6; 111 } 112 if(sFilter=='agenda_hot') 113 { 114 sFillColor = '#FFEE00'; 115 sShape = 'circlepin'; 116 iZIndex = 2; 117 ilegendIndex = 2; 118 sColor = '#004EFF'; 119 sWidth = 6; 120 sHeight = 6; 121 } 122 if(sFilter=='dividendes') 123 { 124 sFillColor = '#3fcc00'; 125 sShape = 'circlepin'; 126 iZIndex = 3; 127 ilegendIndex = 1; 128 sColor = '#004EFF'; 129 sWidth = 6; 130 sHeight = 6; 131 } 132 if(sFilter=='consensus') 133 { 134 sFillColor = '#C155FF'; 135 sShape = 'circlepin'; 136 sColor = '#004EFF'; 137 sWidth = 6; 138 sHeight = 6; 139 } 140 141 seriesToComplete = { 142 allowOverlapX: true, 143 type : 'flags', 144 data : [], 145 tooltip: { 146 pointFormat : '<span style="color:black">{point.text}</span>', 147 }, 148 onSeries : 'myValueSeries', 149 shape: sShape, 150 width:sWidth, 151 height:sHeight, 152 zIndex:iZIndex, 153 legendIndex:ilegendIndex, 154 id : id, 155 distance: 0, 156 fillColor: sFillColor, 157 color: sColor, 158 title : " ", 159 states:{ 160 hover:{ 161 fillColor: "#01DFD7", 162 color: "#01DFD7", 163 } 164 }, 165 lineWidth: 1, 166 style: { 167 //fontStyle: "italic", 168 fontFamily: "Hoefler Text", 169 fontWeight: "bold", 170 171 } 172 }; 173 174 175 var lastFlag = {x:0}, 176 nbNewsInFlag = 0; 177 178 while(newsData = aNews.shift()) 179 { 180 var aValAssoc = newsData['valeurs'].split(','); 181 if((aValidSource.length==0 || aValidSource.indexOf(newsData['source'])>=0)&&(newsData['sous_rubrique']!="commentaire_seance")&&(aValAssoc.length<=3)) 182 { 183 var titleNews; 184 if((typeof newsData['titre_origine'] === "string") && (newsData['titre_origine']!="")) 185 titleNews = ((newsData['titre_origine'].length > 50) && (chart.userOptions.chart.renderTo=="graphNewsMini")) ? newsData['titre_origine'].substr(0,50)+'...' : newsData['titre_origine']; 186 else 187 titleNews = ((newsData['titre'].length > 50) && (chart.userOptions.chart.renderTo=="graphNewsMini")) ? newsData['titre'].substr(0,50)+'...' : newsData['titre']; 188 189 190 if((sFilter=='agenda' || sFilter=='agenda_hot'|| sFilter=='dividendes') && newsData['titre']!='') 191 titleNews = ((newsData['titre'].length > 50) && (chart.userOptions.chart.renderTo=="graphNewsMini")) ? newsData['titre'].substr(0,50)+'...' : newsData['titre']; 192 193 var dateNews = new Date(newsData['date']).getTime(); 194 if(dateNews!=lastFlag.x) 195 { 196 if(lastFlag.x>0) 197 { 198 if((nbNewsInFlag > 5) && (chart.userOptions.chart.renderTo=="graphNewsMini"))
199 lastFlag.text+="<tr><td class='newsColCT'>...</td></tr>"; 200 201 lastFlag.text+="</table>"; 202 seriesToComplete.data.push(lastFlag); 203 } 204 var sTitle = 'i' 205 if(sFilter=='agenda' || sFilter=='agenda_hot' || sFilter=='dividendes' || sFilter=='consensus') 206 { 207 sTitle = ''; 208 } 209 210 var sText = '<table border="0" class="tabBody" cellspacing="0" cellpadding="0"><tr><td class="newsColCT">• <a href="'+newsData['link']+'" target="_blank">'+titleNews+'</a></td></tr>'; 211 if(newsData['link']=='' || typeof newsData['link'] === "undefined" || newsData['link']==window.location.pathname) 212 sText = '<table border="0" class="tabBody" cellspacing="0" cellpadding="0"><tr><td class="newsColCT">• '+titleNews+'</td></tr>'; 213 214 lastFlag = { 215 x : dateNews, 216 title : sTitle, 217 text : sText, 218 id : newsData['id'], 219 }; 220 221 nbNewsInFlag = 1; 222 } 223 else if((nbNewsInFlag < 5) || (chart.userOptions.chart.renderTo!="graphNewsMini")) 224 {
225 lastFlag.text+="<tr><td class='newsColCT'>• <a href='"+newsData['link']+"' target='_blank'>"+titleNews+"</a></td></tr>"; 226 nbNewsInFlag++; 227 } 228 else 229 { 230 nbNewsInFlag++ 231 } 232 } 233 } 234 235 if(lastFlag.x>0) 236 { 237 lastFlag.text+="</table>"; 238 seriesToComplete.data.push(lastFlag); 239 } 240 241 chart.addSeries(seriesToComplete,true,false); 242 chart.hideLoading(); 243} 244 245function loadAgenda(codeZB,inDiv) 246{ 247 $("#moreNewsButton").prop('disabled', true); 248 $.ajax({url : URL_SERVEUR+'atDataFeed.php', 249 cache: false, 250 context : document.body, 251 async : true, 252 data : {codeZB : codeZB, type : "agenda"/*, limitFrom : nbNewsDisplayed, nbNews : 20*/}, 253 type : 'GET', 254 success : function(data){ 255 handleDataAgenda(data,inDiv); 256 } 257 }); 258} 259 260function loadAgendaSecteur(codeZB,inDiv) 261{ 262 $("#moreNewsButton").prop('disabled', true); 263 $.ajax({url : URL_SERVEUR+'atDataFeed.php', 264 cache: false, 265 context : document.body, 266 async : true, 267 data : {codeZB : codeZB, type : "agenda", reqSector : 1, eventType : "publications,activité", sFilter : "agenda_secteur"}, 268 type : 'GET', 269 success : function(data){ 270 handleDataAgendaSecteur(data,inDiv); 271 } 272 }); 273} 274 275function loadAgendaFromDate(codeZB,fromDate,inDiv,sEventType,bConcurence,bOnSeries) 276{ 277 $("#moreNewsButton").prop('disabled', true); 278 $.ajax({url : URL_SERVEUR+'atDataFeed.php', 279 cache: false, 280 context : document.body, 281 async : true, 282 data : {codeZB : codeZB, type : "agenda", datemin: fromDate, reqSector: bConcurence, eventType: sEventType}, 283 type : 'GET', 284 success : function(data){ 285 handleDataAgenda(data,inDiv,bOnSeries); 286 } 287 }); 288} 289 290function handleDataAgendaSecteur(data,inDiv,bOnSeries) 291{ 292 var aEvents; 293 try{ 294 aEvents = JSON.parse(data); 295 } catch(e){ 296 console.log(e); 297 console.log(data); 298 return; 299 } 300 301 seriesEvents = { 302 id: 'newsSeriesSecteur', 303 allowOverlapX: true, 304 type : 'flags', 305 name : 'events', 306 showInLegend : true, 307 xAxis: 1, 308 data : [], 309 shape: 'circle', 310 width:6, 311 height:6, 312 legendIndex:4, 313 y: -15, 314 315 fillColor: '#e1fefe', 316 color: '#004EFF', 317 tooltip: { 318 pointFormat : '<span style="color:{black}">{point.text}</span><br/>' 319 } 320 } 321 322 if(bOnSeries===true) 323 seriesEvents.onSeries = 'myValueSeries'; 324 325 $.each(aEvents,function(index,data){ 326 seriesEvents.data.push({ 327 x : (new Date(data['date_publication']).getTime())||(new Date(data['date']).getTime()), 328 title : ' ', 329 text : '<table border="0" class="tabBody" cellspacing="0" cellpadding="0"><tr><td class="newsColCT">• <a href="'+data['link']+'" target="_blank">'+data['titre']+'</a></td></tr>', 330 id : data['id'], 331 }); 332 }); 333 334 var chart = $("#"+inDiv+"").highcharts(); 335 chart.addSeries(seriesEvents,true,false); 336 chart.hideLoading(); 337} 338 339function handleDataAgenda(data,inDiv,bOnSeries) 340{ 341 var aEvents; 342 try{ 343 aEvents = JSON.parse(data); 344 } catch(e){ 345 console.log(e); 346 console.log(data); 347 return; 348 } 349 350 seriesEvents = { 351 allowOverlapX: true, 352 type : 'flags', 353 name : 'events', 354 showInLegend : false, 355 xAxis: 1, 356 width:12, 357 height:12, 358 data : [], 359 shape: 'squarepin', 360 tooltip: { 361 pointFormat : '<span style="color:{black}">{point.text}</span><br/>' 362 } 363 } 364 365 if(bOnSeries===true) 366 seriesEvents.onSeries = 'myValueSeries'; 367 368 $.each(aEvents,function(index,data){ 369 seriesEvents.data.push({ 370 x : (new Date(data['date_publication']).getTime())||(new Date(data['date']).getTime()), 371 title : data['flag_title'], 372 text : data['titre'].split(" : ")[1], 373 id : data['id'], 374 color : data['flag_color'] 375 }); 376 }); 377 378 var chart = $("#"+inDiv+"").highcharts(); 379 chart.addSeries(seriesEvents,true,false); 380 chart.hideLoading(); 381} 382 383function drawGraphNews(repNo,codeZB,nomSoc,inDiv,nbDecimals,aWords,bIsMobile,sFilter) 384{ 385 sFilter = (typeof sFilter === "undefined") ? "" : sFilter; 386 //axis labels for crosshairs 387 /* 388 // configuration and defaults : 389 // enabled -> bool / false, 390 // fontSize -> String / '11px', 391 // fontFamily -> String / 'Arial', 392 // fontColor -> String / 'black' <=> "#000000", 393 // backgroundColor ->
393 String / "#FFFFFF", 394 // borderColor -> String / 'black' <=> "#000000", 395 // borderWidth -> int / 1, 396 // yAxisLinked -> array / [0], 397 // xAxisLinked -> array / [0], 398 // yValueDecimals -> array / [0], if yAxisLinked > yValueDecimals complete yValueDecimals with 0 399 // xValueDecimals -> array / [0] if xAxisLinked > xValueDecimals complete xValueDecimals with 0 400 // 401 */ 402 (function (H) { 403 'use strict'; 404 var addEvent = H.addEvent, 405 doc = document, 406 body = doc.body, 407 formatIfNeeded = function(value,axis,nbDec) 408 { 409 var categories = axis.categories, 410 numericSymbols = chart.options.lang.numericSymbols, 411 i = numericSymbols && numericSymbols.length, 412 multi, 413 ret, 414 nbDec = (typeof nbDec === "undefined") ? 0 : nbDec, 415 // make sure the same symbol is added for all labels on a linear axis 416 numericSymbolDetector = axis.isLog ? value : axis.tickInterval; 417 418 if(i && numericSymbolDetector >= 1000 && !categories) { 419 // Decide whether we should add a numeric symbol like k (thousands) or M (millions). 420 // If we are to enable this in tooltip or other places as well, we can move this 421 // logic to the numberFormatter and enable it by a parameter. 422 while (i-- && (typeof ret === "undefined")) { 423 multi = Math.pow(1000, i + 1); 424 if (numericSymbolDetector >= multi && numericSymbols[i] !== null) { 425 ret = (value / multi).toFixedDown(nbDec) + numericSymbols[i]; 426 } 427 } 428 } 429 430 if (typeof ret === "undefined") 431 ret = false;
432 433 return ret; 434 }; 435 436 H.wrap(H.Chart.prototype, 'init', function (proceed) { 437 438 // Run the original proceed method 439 proceed.apply(this, Array.prototype.slice.call(arguments, 1)); 440 441 var chart = this, 442 options = chart.options, 443 panning = options.chart.panning || true, 444 zoomType = options.chart.zoomType || '', 445 container = chart.container, 446 yAxis = chart.get('mainAxeValeurs'), 447 yPixels, 448 xPixels, 449 configuration = options.crosshairsLabels||{}, 450 enabled = configuration.enabled||false, 451 fontSize = configuration.fontSize||'11px', 452 fontFamily = configuration.fontFamily || 'Arial', 453 fontColor = configuration.fontColor || 'black', 454 backgroundColor = configuration.backgroundColor||"#FFFFFF", 455 borderColor = configuration.borderColor||"black", 456 borderWidth = (typeof configuration.borderWidth ==="undefined") ? 1 : configuration.borderWidth, 457 yAxisLinked = configuration.yAxisLinked || [0], 458 xAxisLinked = configuration.xAxisLinked || [0], 459 yValueDecimals = configuration.yValueDecimals || [0], 460 xValueDecimals = configuration.xValueDecimals || [0]; 461 462 463 464 465 466 if(yAxisLinked.length>yValueDecimals.length) 467 { 468 do 469 { 470 yValueDecimals.push(0); 471 } 472 while(yAxisLinked.length>yValueDecimals.length) 473 } 474 475 if(xAxisLinked.length>xValueDecimals.length) 476 { 477 do 478 { 479 xValueDecimals.push(0); 480 } 481 while(xAxisLinked.length>xValueDecimals.length) 482 } 483 484 if(enabled) 485 { 486 var yLabel = chart.renderer.text( 487 "Temp", 488 chart.plotBox.width+chart.plotBox.x+20+6, 489 0 490 ) 491 .css({ 492 fontFamily : fontFamily, 493 fontSize: fontSize, 494 color: fontColor 495 }). 496 attr({ 497 id : 'yLabel', 498 opacity: 0, 499 zIndex: 7 500 }) 501 .add(); 502 503 //sampleDate.getDate()+' '+aMonths[sampleDate.getMonth()]+' '+sampleDate.getFullYear() 504 var xLabel = chart.renderer.text( 505 "Temp", 506 0, 507 chart.plotBox.height+chart.plotBox.y+3 508 ) 509 .css({ 510 fontFamily : fontFamily, 511 fontSize: fontSize, 512 color: fontColor 513 }). 514 attr({ 515 id : 'xLabel', 516 opacity: 0, 517 zIndex: 7 518 }) 519 .add(); 520 521 var yBox = chart.renderer.rect( 522 yLabel.getBBox().x-3, 523 yLabel.getBBox().y-2, 524 yLabel.getBBox().width+6, 525 yLabel.getBBox().height+4, 526 0) 527 .attr({ 528 fill: backgroundColor, 529 stroke: borderColor, 530 'stroke-width': borderWidth, 531 opacity: 0, 532 id : 'yBox', 533 zIndex: 6 534 }) 535 .add(); 536 537 var xBox = chart.renderer.rect( 538 xLabel.getBBox().x-3, 539 xLabel.getBBox().y-2, 540 xLabel.getBBox().width+6, 541 xLabel.getBBox().height+4, 542 0) 543 .attr({ 544 fill: backgroundColor, 545 stroke: borderColor, 546 'stroke-width': borderWidth, 547 opacity: 0, 548 id : 'xBox', 549 zIndex: 6 550 }) 551 .add(); 552 553 addEvent(chart.container, 'mousemove', function (e) 554 { 555 yPixels = chart.pointer.normalize(e).chartY; 556 xPixels = chart.pointer.normalize(e).chartX; 557 558 if((yPixels>chart.plotBox.y)&&(yPixels<chart.plotBox.y+chart.plotBox.height)&&(xPixels>chart.plotBox.x)&&(xPixels<chart.plotBox.x+chart.plotBox.width)) 559 { 560 $.each(yAxisLinked,function(index,axis){ 561 if((yPixels>chart.yAxis[axis].top)&&(yPixels<chart.yAxis[axis].top+chart.yAxis[axis].height)) 562 { 563 var yLabelText = formatIfNeeded(chart.yAxis[axis].toValue(yPixels),chart.yAxis[axis],yValueDecimals[axis]); 564 yLabelText = (yLabelText) ? yLabelText : Math.floor(chart.yAxis[axis].toValue(yPixels) * Math.pow(10,yValueDecimals[axis])) / Math.pow(10,yValueDecimals[axis]); 565 566 yLabel.attr({ 567 text: yLabelText, 568 opacity: 1 569 }); 570 yBox.attr({ 571 width: yLabel.getBBox().width+6, 572 x: chart.plotBox.x + chart.plotBox.width, 573 y: yPixels-(yBox.attr('height')/2), 574 opacity: 1 575 }); 576 yLabel.attr({ 577 y: yBox.attr('y')+parseInt(fontSize)+1, 578 x: yBox.attr('x')+3 579 }); 580 return false; 581 } 582 else 583 { 584 yBox.attr({ 585 opacity: 0 586 }); 587 yLabel.attr({ 588 opacity: 0 589 }); 590 } 591 }); 592 593 //Adjust xPixels' value to fit the hoverPoint 594 //xPixels = chart.xAxis[0].toPixels(chart.hoverPoints[0].x); 595 596 $.each(xAxisLinked,function(index,axis){ 597 if((xPixels>chart.xAxis[axis].left)&&(xPixels<chart.xAxis[axis].left+chart.xAxis[axis].width)) 598 { 599 var xLabelText; 600 if(chart.xAxis[axis].options.type=="datetime") 601 { 602 var newDate = new Date(chart.xAxis[axis].toValue(xPixels)); 603 xLabelText = newDate.getDate()+' '+aMonths[newDate.getMonth()]+' '+newDate.getFullYear(); 604 } 605 else 606 { 607 xLabelText = Math.floor(chart.xAxis[axis].toValue(xPixels) * Math.pow(10,xValueDecimals[axis])) / Math.pow(10,xValueDecimals[axis]); 608 } 609 610 611 xLabel.attr({ 612 text: xLabelText, 613 y: chart.plotBox.height+chart.plotBox.y+parseInt(fontSize)+3+2, //bollow plotBox + fontSize + margin + padding 614 opacity: 1 615 }); 616 xBox.attr({ 617 width: xLabel.getBBox().width+6, 618 opacity: 1 619 }); 620 xBox.attr({ 621 x: xPixels-(xBox.attr('width')/2), 622 y: chart.plotBox.height+chart.plotBox.y+3 623 }); 624 xLabel.attr({ 625 x: xBox.attr('x')+3 626 }); 627 628 return false;
629 } 630 else 631 { 632 xBox.attr({ 633 opacity: 0 634 }); 635 xLabel.attr({ 636 opacity: 0 637 }); 638 } 639 640 }); 641 } 642 else 643 { 644 yBox.attr({ 645 opacity: 0 646 }); 647 xBox.attr({ 648 opacity: 0 649 }); 650 yLabel.attr({ 651 opacity: 0 652 }); 653 xLabel.attr({ 654 opacity: 0 655 }); 656 } 657 }); 658 } 659 }); 660 }(Highcharts)); 661 662 bIsMobile = (typeof bIsMobile === "undefined") ? false : bIsMobile; 663 664 665 666 var creditsLink = (bIsMobile) ? null : 'http://www.'+aWords[0]; 667 668 669 var creditsText = '\u00A9'+aWords[0]; 670 var creditsEnable = true; 671 672 if(sFilter=='agenda' || sFilter=='consensus') 673 { 674 creditsText = ''; 675 creditsEnable = false; 676 } 677 678 679 680 if(sFilter=='agenda' || sFilter=='consensus') 681 { 682 683 684 Highcharts.setOptions({ 685 lang: { 686 rangeSelectorZoom:'', 687 }, 688 }); 689 690 var options = { 691 692 chart : { 693 animation : false, 694 renderTo : inDiv , 695 spacingRight : 10, 696 style : 697 { 698 fontFamily : 'Arial, Helvetica, Sans-Serif', 699 color: "black" 700 }, 701 events: { 702 load: function(){ 703 var imageHeight = 25; 704 var imageWidth = 240; 705 if(sFilter=='') 706 this.renderer.image("https://www.zonebourse.com/images/pdf_Report/"+aWords[0].capitalize()+".png",20,55,imageWidth,imageHeight).css({opacity: 0.5}).attr({zIndex: 2}).add(); 707 // document.getElementsByClassName("highcharts-range-selector-buttons")[0].firstChild.textContent = ""; 708 } 709 }, 710 pinchType: "", 711 712 }, 713 714 credits : { 715 enabled : creditsEnable, 716 href : creditsLink, 717 text : creditsText, 718 style : { 719 fontSize : '12px' 720 } 721 }, 722 723 crosshairsLabels: { 724 enabled: true, 725 fontSize: '11px', 726 fontFamily : 'Tahoma', 727 backgroundColor: "#FFEE00", 728 borderColor: "black", 729 borderWidth: 1, 730 yValueDecimals : [nbDecimals,1], 731 yAxisLinked : [0,1], 732 xAxisLinked : [0] 733 }, 734 735 exporting : { 736 enabled : false 737 }, 738 739 rangeSelector : configSelectorAgenda, 740 741 title : { 742 text : null 743 }, 744 745 scrollbar: { 746 enabled: false 747 }, 748 749 navigator: { 750 enabled : false, 751 }, 752 753 legend: { 754 enabled : true, 755 useHTML: true, 756 757 squareSymbol: false, 758 symbolHeight: 0, 759 symbolWidth: 0, 760 symbolRadius: 0, 761 itemStyle: { 762 fontWeight: 'normal', 763 textOverflow: "" 764 }, 765 766 labelFormatter: function() { 767 768 var color = ''; 769 var name = ''; 770 if(this.userOptions.id=="newsSeriesAgendaHot") 771 { 772 color = '#FFEE00'; 773 name = aWords[2]; 774 } 775 if(this.userOptions.id=="newsSeries") 776 { 777 color = 'white'; 778 name = aWords[3]; 779 } 780 if(this.userOptions.id=="newsSeriesDividendes") 781 { 782 color = '#3fcc00'; 783 name = aWords[4]; 784 } 785 if(this.userOptions.id=="newsSeriesSecteur") 786 { 787 color = '#e1fefe'; 788 name = aWords[5]; 789 } 790 if(this.userOptions.id=="newsSeriesConsensus") 791 { 792 color = '#C155FF'; 793 name = aWords[3]; 794 } 795 return '<div style="border-radius:50%;border:1px solid #004EFF;background:'+color+';width:10px;height:10px;float:left;margin-top:1px;margin-right:2px;"> </div> ' + name; 796 } 797 }, 798 799 tooltip : { 800 801 backgroundColor: { 802 linearGradient: { 803 x1: 0, 804 y1: 0, 805 x2: 0, 806 y2: 1 807 }, 808 stops: [ 809 [0, 'white'], 810 [1, '#EEE'] 811 ] 812 }, 813 hideDelay: 1500, 814 borderColor: 'gray', 815 borderWidth: 1, 816 borderRadius: 5, 817 shared : true, 818 split: false, 819 headerFormat: '<span style="font-size:12px">'+aWords[1]+' : <b>{point.key}</b></span><br>', 820 xDateFormat: dateFormatDay, 821 useHTML: true, 822 style: { 823 pointerEvents: 'auto' 824 } 825 }, 826 827 plotOptions: { 828 candlestick: {
829 color: '#FF0000', //close<open 830 upColor: '#00FF00', //close>open 831 pointPadding: 0.1, 832 enableMouseTracking : false 833 }, 834 column: { 835 color: '#1a324a', //volume color 836 pointPadding: 0.01, 837 enableMouseTracking : false 838 }, 839 line: { 840 lineWidth : 2, 841 enableMouseTracking : false, 842 color : '#1A324A' 843 }, 844 ohlc: { 845 enableMouseTracking : false 846 }, 847 flags : { 848 states : { 849 hover : { 850 fillColor : "#81DAF5" 851 } 852 }, 853 lineWidth : 1 854 }, 855 series: { 856 pointPlacement: "between", 857 dataGrouping: { 858 units:[ 859 ['day',[1]] 860 ], 861 dateTimeLabelFormats: { 862 day : [dateFormatDay], 863 } 864 } 865 } 866 }, 867 868 xAxis: [ 869 { 870 allowDecimals: false, 871 endOnTick: false, 872 labels: { 873 align: 'center', 874 style: { 875 color: "black" 876 }, 877 zIndex: 5 878 }, 879 lineWidth: 1, 880 lineColor: 'black', 881 gridLineColor: "#ededed", 882 gridLineWidth: 1, 883 title: null, 884 minRange: 3600*24*30*1000, 885 tickWidth: 1, 886 tickLength: 5, 887 tickColor: 'black', 888 showFirstLabel: true, 889 crosshair: { 890 snap: false 891 } 892 }, 893 { 894 lineWidth: 1, 895 margin: [0, 0, 0, 0], 896 spacing:[0, 0, 0, 0], 897 distance:0, 898 lineColor: "black", 899 tickWidth: 0, 900 linkedTo: 0, 901 tickLength: 0, 902 labels: { 903 enabled: false 904 }, 905 offset : 0, 906 crosshair: { 907 snap: false 908 } 909 }], 910 911 yAxis: [{ 912 id: "mainAxeValeurs", 913 lineWidth: 1, 914 gridLineColor: "#ededed", 915 title: "variation", 916 lineColor: 'black', 917 maxPadding: 0.12, 918 tickWidth: 1, 919 tickLength: 5, 920 tickColor: 'black', 921 tickPixelInterval: 50, 922 endOnTick: false, 923 startOnTick: false, 924 labels: { 925 align: 'left', 926 x: 10, 927 style : { 928 color: "black" 929 } 930 }, 931 showLastLabel: true, 932 type: 'logarithmic', 933 offset: 20, 934 crosshair: { 935 snap: false 936 } 937 }, 938 { 939 id : 'axeVolumes', 940 title: null, 941 top: '80%', 942 height: '0%', 943 gridLineWidth: 1, 944 gridLineColor: "#ededed", 945 lineWidth: 1, 946 lineColor: "black", 947 tickWidth: 1, 948 tickLength: 5, 949 tickColor: 'black', 950 offset : 20, 951 scalable: false, 952 labels : { 953 align : 'left', 954 x : 5, 955 style: { 956 color: "black" 957 } 958 }, 959 showEmpty : false, 960 showLastLabel: true, 961 endOnTick: false, 962 crosshair: { 963 snap: false 964 } 965 }] 966 967 968 }; 969 970 971 972 } 973 else 974 { 975 var options = { 976 chart : { 977 renderTo : inDiv , 978 spacingRight : 10, 979 marginBottom : 20, 980 spacingBottom : 20, 981 982 style : 983 { 984 fontFamily : 'Arial, Helvetica, Sans-Serif', 985 color: "black" 986 }, 987 events: { 988 load: function(){ 989 var imageHeight = 25; 990 var imageWidth = 240; 991 this.renderer.image("https://www.zonebourse.com/images/pdf_Report/"+aWords[0].capitalize()+".png",20,55,imageWidth,imageHeight).css({opacity: 0.5}).attr({zIndex: 2}).add(); 992 } 993 }, 994 pinchType: "", 995 zoomType: "" 996 }, 997 998 exporting : { 999 enabled : false 1000 }, 1001 1002 credits : { 1003 enabled : true, 1004 href : creditsLink, 1005 text : '\u00A9'+aWords[0], 1006 style : { 1007 fontSize : '12px' 1008 } 1009 }, 1010 1011 title : { 1012 text : null 1013 }, 1014 1015 navigator: { 1016 height: 40, 1017 yAxis: { 1018 type : 'logarithmic' 1019 }, 1020 xAxis : { 1021 allowDecimals : false, 1022 endOnTick : true, 1023 maxPadding : 5, 1024 labels: { 1025 style : { 1026 color: "black" 1027 } 1028 } 1029 } 1030 }, 1031 1032 rangeSelector : configSelectorLong, 1033 1034 legend : { 1035 enabled : false 1036 }, 1037 1038 tooltip : { 1039 1040 backgroundColor: { 1041 linearGradient: { 1042 x1: 0, 1043 y1: 0, 1044 x2: 0, 1045 y2: 1 1046 }, 1047 stops: [ 1048 [0, 'white'], 1049 [1, '#EEE'] 1050 ] 1051 }, 1052 hideDelay: 1500, 1053 borderColor: 'gray', 1054 borderWidth: 1, 1055 borderRadius: 5, 1056 shared : true, 1057 split: false, 1058 headerFormat: '<span style="font-size:12px">'+aWords[1]+' : <b>{point.key}</b></span><br>', 1059 xDateFormat: dateFormatDay, 1060 useHTML: true, 1061 dateTimeLabelFormats : { 1062 day : dateFormatDay 1063 }, 1064 style: { 1065 pointerEvents: 'auto' 1066 } 1067 }, 1068 1069 xAxis: [ 1070 { 1071 allowDecimals: false, 1072 endOnTick: false, 1073 labels: { 1074 align: 'center', 1075 style: { 1076 color: "black" 1077 }, 1078 zIndex: 5 1079 }, 1080 lineWidth: 1, 1081 lineColor: 'black', 1082 gridLineColor: "#ededed", 1083 gridLineWidth: 1, 1084 title: null, 1085 minRange: 3600*24*30*1000, 1086 tickWidth: 1, 1087 tickLength: 5, 1088 tickColor: 'black', 1089 showFirstLabel: true, 1090 crosshair: { 1091 snap: false 1092 } 1093 }, 1094 { 1095 lineWidth: 1, 1096 lineColor: "black", 1097 tickWidth: 0, 1098 linkedTo: 0, 1099 tickLength: 0, 1100 labels: { 1101 enabled: false 1102 }, 1103 offset : 0, 1104 crosshair: { 1105 snap: false 1106 } 1107 }], 1108 1109 yAxis: [{ 1110 id: "mainAxeValeurs", 1111 lineWidth: 1, 1112 gridLineColor: "#ededed", 1113 title: "variation", 1114 lineColor: 'black', 1115 maxPadding: 0.1, 1116 tickWidth: 1, 1117 tickLength: 5, 1118 tickColor: 'black', 1119 tickPixelInterval: 50, 1120 endOnTick: false, 1121 startOnTick: false, 1122 labels: { 1123 align: 'left', 1124 x: 10, 1125 style : { 1126 color: "black" 1127 } 1128 }, 1129 showLastLabel: true, 1130 type: 'logarithmic', 1131 offset: 20, 1132 crosshair: { 1133 snap: false 1134 } 1135 }, 1136 { 1137 id : 'axeVolumes', 1138 title: null, 1139 top: '85%', 1140 height: '0%', 1141 gridLineWidth: 1, 1142 gridLineColor: "#ededed", 1143 lineWidth: 1, 1144 lineColor: "black", 1145 tickWidth: 1, 1146 tickLength: 5, 1147 tickColor: 'black', 1148 offset : 20, 1149 scalable: false, 1150 labels : { 1151 align : 'left', 1152 x : 5, 1153 style: { 1154 color: "black" 1155 } 1156 }, 1157 showEmpty : false, 1158 showLastLabel: true, 1159 endOnTick: false, 1160 crosshair: { 1161 snap: false 1162 } 1163 }], 1164 1165 plotOptions: { 1166 candlestick: {
1167 color: '#FF0000', //close<open 1168 upColor: '#00FF00', //close>open 1169 pointPadding: 0.1, 1170 enableMouseTracking : false 1171 }, 1172 column: { 1173 color: '#1a324a', //volume color 1174 pointPadding: 0.01, 1175 enableMouseTracking : false 1176 }, 1177 line: { 1178 lineWidth : 2, 1179 enableMouseTracking : false, 1180 color : '#1A324A' 1181 }, 1182 ohlc: { 1183 enableMouseTracking : false 1184 }, 1185 flags : { 1186 stackDistance: 0, 1187 states : { 1188 hover : { 1189 fillColor : "#81DAF5" 1190 } 1191 }, 1192 lineWidth : 1 1193 }, 1194 series: { 1195 pointPlacement: "between", 1196 dataGrouping: { 1197 units:[ 1198 ['day',[1]] 1199 ], 1200 dateTimeLabelFormats: { 1201 day : [dateFormatDay], 1202 } 1203 } 1204 } 1205 }, 1206 1207 crosshairsLabels: { 1208 enabled: true, 1209 fontSize: '11px', 1210 fontFamily : 'Tahoma', 1211 backgroundColor: "#FFEE00", 1212 borderColor: "black", 1213 borderWidth: 1, 1214 yValueDecimals : [nbDecimals,1], 1215 yAxisLinked : [0,1], 1216 xAxisLinked : [0] 1217 } 1218 }; 1219 } 1220 1221 var chart = new Highcharts.StockChart(options); 1222 1223 chart.showLoading(); 1224 1225 1226 1227 $.ajax({url : URL_SERVEUR+'atDataFeed.php', 1228 cache: false, 1229 context : document.body, 1230 async : true, 1231 data : {codeZB : codeZB, type : "chart", fields : "Date,Open,High,Low,Close"}, 1232 type : 'GET', 1233 success : function(data) 1234 { 1235 1236 try 1237 { 1238 aDataQuote = JSON.parse(data) 1239 } 1240 catch(e) 1241 { 1242 $('#'+inDiv).css('display','none'); 1243 console.log("erreur JSON parse : "+e); 1244 console.log("data received : "+data); 1245 return; 1246 } 1247 1248 1249 var chartSeries = { 1250 type : 'line', 1251 color: "#333333", 1252 name : nomSoc, 1253 data : [], 1254 id : 'myValueSeries', 1255 yAxis: 0, 1256 showInLegend: false, 1257 //zIndex: 0 1258 }; 1259 1260 if(sFilter=='agenda' || sFilter=='consensus') 1261 { 1262 chartSeries.turboThreshold = 20000; 1263 } 1264 1265 1266 1267 if(sFilter=='agenda' || sFilter=='consensus') 1268 { 1269 var i = aDataQuote.length-1; 1270 while((i>=0)){ 1271 chartSeries.data.unshift(aDataQuote[i]); 1272 i--; 1273 } 1274 } 1275 else 1276 { 1277 var now = new Date().getTime(); 1278 var i = aDataQuote.length-1; 1279 while((i>=0)&&(aDataQuote[i]['x']>(now-(3600*24*365*2*1000)))) 1280 { 1281 chartSeries.data.unshift(aDataQuote[i]); 1282 i--; 1283 } 1284 } 1285 1286 1287 // Update the chart 1288 chart.addSeries(chartSeries,true,false); 1289 1290 if(sFilter=='agenda' || sFilter=='consensus') 1291 chart.rangeSelector.clickButton(4,true); 1292 else 1293 chart.rangeSelector.clickButton(2,true); 1294 1295 1296 1297 $.ajax({url : URL_SERVEUR+'atDataFeed.php', 1298 cache: false, 1299 context : document.body, 1300 async : true, 1301 data : {codeZB : codeZB, type : "volumes"}, 1302 type : 'GET', 1303 success : function(data) 1304 { 1305 try 1306 { 1307 aDataQuote = JSON.parse(data) 1308 } 1309 catch(e) 1310 { 1311 $('#'+inDiv).css('display','none'); 1312 console.log("erreur JSON parse : "+e); 1313 console.log("data received : "+data); 1314 return; 1315 } 1316 1317 var volumeSeries = { 1318 showInLegend: false, 1319 animation : false, 1320 type : 'column', 1321 name : 'Volumes', 1322 data : [],//aDataQuote, 1323 yAxis: 'axeVolumes', 1324 id : 'volumes', 1325 color: "#333333", 1326 tooltip: { 1327 pointFormat : '<tr><td style="padding:0;font-size:12px">{series.name}: </td><td style="padding:0;font-size:12px; text-align : right;"><b>{point.y}</b></td></tr>' 1328 }, 1329 dataGrouping: { 1330 units:[ 1331 ['day',[1]] 1332 ], 1333 dateTimeLabelFormats: { 1334 day : [dateFormatDay], 1335 week: [dateFormatWeek] 1336 } 1337 } 1338 }; 1339 1340 1341 1342 1343 if(sFilter=='agenda' || sFilter=='consensus') 1344 { 1345 var i = aDataQuote.length-1; 1346 while((i>=0)){ 1347 volumeSeries.data.unshift(aDataQuote[i]); 1348 i--; 1349 } 1350 } 1351 else 1352 { 1353 var now = new Date().getTime(); 1354 var i = aDataQuote.length-1; 1355 while((i>=0)&&(aDataQuote[i][0]>(now-(3600*24*365*2*1000)))) 1356 { 1357 volumeSeries.data.unshift(aDataQuote[i]); 1358 i--; 1359 } 1360 } 1361 1362 1363 if(aDataQuote.length>0) 1364 { 1365 var chart = $("#"+inDiv).highcharts(); 1366 bGotVolumes = true; 1367 1368 if(sFilter=='') 1369 { 1370 chart.get('axeVolumes').update({ 1371 height: '15%', 1372 tickPixelInterval: chart.plotHeight*(0.1) 1373 }); 1374 chart.get('mainAxeValeurs').update({ 1375 height : '85%' 1376 }); 1377 } 1378 else 1379 { 1380 chart.get('axeVolumes').update({ 1381 height: '20%', 1382 tickPixelInterval: chart.plotHeight*(0.1) 1383 }); 1384 chart.get('mainAxeValeurs').update({ 1385 height : '80%' 1386 }); 1387 } 1388 1389 if(sFilter=='') 1390 { 1391 chart.xAxis[1].update({ 1392 offset: -chart.plotHeight*0.15 1393 }); 1394 } 1395 else 1396 { 1397 chart.xAxis[1].update({ 1398 offset: -chart.plotHeight*0.20 1399 }); 1400 } 1401 1402 chart.addSeries(volumeSeries,true,false); 1403 aChartSeriesID.push(volumeSeries.id); 1404 } 1405 1406 if(typeof callback == "function") callback(); 1407 } 1408 }); 1409 1410 1411 1412
1413 loadMoreNews(codeZB,inDiv,sFilter); 1414 1415 if(sFilter=='agenda') 1416 { 1417 loadMoreNews(codeZB,inDiv,'agenda_hot'); 1418 loadMoreNews(codeZB,inDiv,'dividendes'); 1419 loadAgendaSecteur(codeZB,inDiv); 1420 } 1421 else if(sFilter=='consensus') 1422 { 1423 } 1424 else 1425 loadAgenda(codeZB,inDiv); 1426 1427 }}); 1428} 1429 1430function drawGraphNewsMini(repNo,codeZB,nomSoc,inDiv,nbDecimals,sPage,aWords,bIsMobile) 1431{ 1432 //axis labels for crosshairs 1433 /* 1434 // configuration and defaults : 1435 // enabled -> bool / false, 1436 // fontSize -> String / '11px', 1437 // fontFamily -> String / 'Arial', 1438 // fontColor -> String / 'black' <=> "#000000", 1439 // backgroundColor -> String / "#FFFFFF", 1440 // borderColor -> String / 'black' <=> "#000000", 1441 // borderWidth -> int / 1, 1442 // yAxisLinked -> array / [0], 1443 // xAxisLinked -> array / [0], 1444 // yValueDecimals -> array / [0], if yAxisLinked > yValueDecimals complete yValueDecimals with 0 1445 // xValueDecimals -> array / [0] if xAxisLinked > xValueDecimals complete xValueDecimals with 0 1446 // 1447 */ 1448 (function (H) { 1449 'use strict'; 1450 var addEvent = H.addEvent, 1451 doc = document, 1452 body = doc.body, 1453 formatIfNeeded = function(value,axis,nbDec) 1454 { 1455 var categories = axis.categories, 1456 numericSymbols = chart.options.lang.numericSymbols, 1457 i = numericSymbols && numericSymbols.length, 1458 multi, 1459 ret, 1460 nbDec = (typeof nbDec === "undefined") ? 0 : nbDec, 1461 // make sure the same symbol is added for all labels on a linear axis 1462 numericSymbolDetector = axis.isLog ? value : axis.tickInterval; 1463 1464 if(i && numericSymbolDetector >= 1000 && !categories) { 1465 // Decide whether we should add a numeric symbol like k (thousands) or M (millions). 1466 // If we are to enable this in tooltip or other places as well, we can move this 1467 // logic to the numberFormatter and enable it by a parameter. 1468 while (i-- && (typeof ret === "undefined")) { 1469 multi = Math.pow(1000, i + 1); 1470 if (numericSymbolDetector >= multi && numericSymbols[i] !== null) { 1471 ret = (value / multi).toFixedDown(nbDec) + numericSymbols[i]; 1472 } 1473 } 1474 } 1475 1476 if (typeof ret === "undefined") 1477 ret = false;
1478 1479 return ret; 1480 }; 1481 1482 H.wrap(H.Chart.prototype, 'init', function (proceed) { 1483 1484 // Run the original proceed method 1485 proceed.apply(this, Array.prototype.slice.call(arguments, 1)); 1486 1487 var chart = this, 1488 options = chart.options, 1489 panning = options.chart.panning || true, 1490 zoomType = options.chart.zoomType || '', 1491 container = chart.container, 1492 yAxis = chart.get('mainAxeValeurs'), 1493 yPixels, 1494 xPixels, 1495 configuration = options.crosshairsLabels||{}, 1496 enabled = configuration.enabled||false, 1497 fontSize = configuration.fontSize||'11px', 1498 fontFamily = configuration.fontFamily || 'Arial', 1499 fontColor = configuration.fontColor || 'black', 1500 backgroundColor = configuration.backgroundColor||"#FFFFFF", 1501 borderColor = configuration.borderColor||"black", 1502 borderWidth = (typeof configuration.borderWidth ==="undefined") ? 1 : configuration.borderWidth, 1503 yAxisLinked = configuration.yAxisLinked || [0], 1504 xAxisLinked = configuration.xAxisLinked || [0], 1505 yValueDecimals = configuration.yValueDecimals || [0], 1506 xValueDecimals = configuration.xValueDecimals || [0]; 1507 1508 if(yAxisLinked.length>yValueDecimals.length) 1509 { 1510 do 1511 { 1512 yValueDecimals.push(0); 1513 } 1514 while(yAxisLinked.length>yValueDecimals.length) 1515 } 1516 1517 if(xAxisLinked.length>xValueDecimals.length) 1518 { 1519 do 1520 { 1521 xValueDecimals.push(0); 1522 } 1523 while(xAxisLinked.length>xValueDecimals.length) 1524 } 1525 1526 if(enabled) 1527 { 1528 var yLabel = chart.renderer.text( 1529 "Temp", 1530 chart.plotBox.width+chart.plotBox.x+20+6, 1531 0 1532 ) 1533 .css({ 1534 fontFamily : fontFamily, 1535 fontSize: fontSize, 1536 color: fontColor 1537 }). 1538 attr({ 1539 id : 'yLabel', 1540 opacity: 0, 1541 zIndex: 7 1542 }) 1543 .add(); 1544 1545 //sampleDate.getDate()+' '+aMonths[sampleDate.getMonth()]+' '+sampleDate.getFullYear() 1546 var xLabel = chart.renderer.text( 1547 "Temp", 1548 0, 1549 chart.plotBox.height+chart.plotBox.y+3 1550 ) 1551 .css({ 1552 fontFamily : fontFamily, 1553 fontSize: fontSize, 1554 color: fontColor 1555 }). 1556 attr({ 1557 id : 'xLabel', 1558 opacity: 0, 1559 zIndex: 7 1560 }) 1561 .add(); 1562 1563 var yBox = chart.renderer.rect( 1564 yLabel.getBBox().x-3, 1565 yLabel.getBBox().y-2, 1566 yLabel.getBBox().width+6, 1567 yLabel.getBBox().height+4, 1568 0) 1569 .attr({ 1570 fill: backgroundColor, 1571 stroke: borderColor, 1572 'stroke-width': borderWidth, 1573 opacity: 0, 1574 id : 'yBox', 1575 zIndex: 6 1576 }) 1577 .add(); 1578 1579 var xBox = chart.renderer.rect( 1580 xLabel.getBBox().x-3, 1581 xLabel.getBBox().y-2, 1582 xLabel.getBBox().width+6, 1583 xLabel.getBBox().height+4, 1584 0) 1585 .attr({ 1586 fill: backgroundColor, 1587 stroke: borderColor, 1588 'stroke-width': borderWidth, 1589 opacity: 0, 1590 id : 'xBox', 1591 zIndex: 6 1592 }) 1593 .add(); 1594 1595 addEvent(chart.container, 'mousemove', function (e) 1596 { 1597 yPixels = chart.pointer.normalize(e).chartY; 1598 xPixels = chart.pointer.normalize(e).chartX; 1599 1600 if((yPixels>chart.plotBox.y)&&(yPixels<chart.plotBox.y+chart.plotBox.height)&&(xPixels>chart.plotBox.x)&&(xPixels<chart.plotBox.x+chart.plotBox.width)) 1601 { 1602 $.each(yAxisLinked,function(index,axis){ 1603 if((yPixels>chart.yAxis[axis].top)&&(yPixels<chart.yAxis[axis].top+chart.yAxis[axis].height)) 1604 { 1605 var yLabelText = formatIfNeeded(chart.yAxis[axis].toValue(yPixels),chart.yAxis[axis],yValueDecimals[axis]); 1606 yLabelText = (yLabelText) ? yLabelText : Math.floor(chart.yAxis[axis].toValue(yPixels) * Math.pow(10,yValueDecimals[axis])) / Math.pow(10,yValueDecimals[axis]); 1607 1608 yLabel.attr({ 1609 text: yLabelText, 1610 opacity: 1 1611 }); 1612 yBox.attr({ 1613 width: yLabel.getBBox().width+6, 1614 x: chart.plotBox.x + chart.plotBox.width, 1615 y: yPixels-(yBox.attr('height')/2), 1616 opacity: 1 1617 }); 1618 yLabel.attr({ 1619 y: yBox.attr('y')+parseInt(fontSize)+1, 1620 x: yBox.attr('x')+3 1621 }); 1622 return false; 1623 } 1624 else 1625 { 1626 yBox.attr({ 1627 opacity: 0 1628 }); 1629 yLabel.attr({ 1630 opacity: 0 1631 }); 1632 } 1633 }); 1634 1635 //Adjust xPixels' value to fit the hoverPoint 1636 //xPixels = chart.xAxis[0].toPixels(chart.hoverPoints[0].x); 1637 1638 $.each(xAxisLinked,function(index,axis){ 1639 if((xPixels>chart.xAxis[axis].left)&&(xPixels<chart.xAxis[axis].left+chart.xAxis[axis].width)) 1640 { 1641 var xLabelText; 1642 if(chart.xAxis[axis].options.type=="datetime") 1643 { 1644 var newDate = new Date(chart.xAxis[axis].toValue(xPixels)); 1645 xLabelText = newDate.getDate()+' '+aMonths[newDate.getMonth()]+' '+newDate.getFullYear(); 1646 } 1647 else 1648 { 1649 xLabelText = Math.floor(chart.xAxis[axis].toValue(xPixels) * Math.pow(10,xValueDecimals[axis])) / Math.pow(10,xValueDecimals[axis]); 1650 } 1651 1652 1653 xLabel.attr({ 1654 text: xLabelText, 1655 y: chart.plotBox.height+chart.plotBox.y+parseInt(fontSize)+3+2, //bollow plotBox + fontSize + margin + padding 1656 opacity: 1 1657 }); 1658 xBox.attr({ 1659 width: xLabel.getBBox().width+6, 1660 opacity: 1 1661 }); 1662 xBox.attr({ 1663 x: xPixels-(xBox.attr('width')/2), 1664 y: chart.plotBox.height+chart.plotBox.y+3 1665 }); 1666 xLabel.attr({ 1667 x: xBox.attr('x')+3 1668 }); 1669 1670 return false;
1671 } 1672 else 1673 { 1674 xBox.attr({ 1675 opacity: 0 1676 }); 1677 xLabel.attr({ 1678 opacity: 0 1679 }); 1680 } 1681 1682 }); 1683 } 1684 else 1685 { 1686 yBox.attr({ 1687 opacity: 0 1688 }); 1689 xBox.attr({ 1690 opacity: 0 1691 }); 1692 yLabel.attr({ 1693 opacity: 0 1694 }); 1695 xLabel.attr({ 1696 opacity: 0 1697 }); 1698 } 1699 }); 1700 } 1701 }); 1702 }(Highcharts)); 1703 1704 bIsMobile = (typeof bIsMobile === "undefined") ? false : bIsMobile; 1705 1706 var creditsLink = (bIsMobile) ? null : 'http://www.'+aWords[0]; 1707 1708 var options = { 1709 chart : { 1710 renderTo : inDiv , 1711 style : 1712 { 1713 fontFamily : 'Arial, Helvetica, Sans-Serif', 1714 color: "black" 1715 }, 1716 pinchType: "", 1717 zoomType: "", 1718 panning: false 1719 }, 1720 1721 credits : { 1722 enabled : false 1723 }, 1724 1725 crosshairsLabels: { 1726 enabled: true, 1727 fontSize: '11px', 1728 fontFamily : 'Tahoma', 1729 backgroundColor: "#FFEE00", 1730 borderColor: "black", 1731 borderWidth: 1, 1732 yValueDecimals : [nbDecimals,1], 1733 yAxisLinked : [0,1], 1734 xAxisLinked : [0] 1735 }, 1736 1737 1738 legend : { 1739 enabled : false 1740 }, 1741 1742 navigator: { 1743 enabled: false 1744 }, 1745 1746 plotOptions: { 1747 candlestick: {
1748 color: '#FF0000', //close<open 1749 upColor: '#00FF00', //close>open 1750 pointPadding: 0.1, 1751 enableMouseTracking : false 1752 }, 1753 column: { 1754 color: '#1a324a', //volume color 1755 pointPadding: 0.01, 1756 enableMouseTracking : false 1757 }, 1758 line: { 1759 lineWidth : 2, 1760 enableMouseTracking : false, 1761 color : '#1A324A' 1762 }, 1763 ohlc: { 1764 enableMouseTracking : false 1765 }, 1766 flags : { 1767 stackDistance: 0, 1768 states : { 1769 hover : { 1770 fillColor : "#81DAF5" 1771 } 1772 }, 1773 lineWidth : 1 1774 }, 1775 series: { 1776 pointPlacement: "between", 1777 dataGrouping: { 1778 enabled: true, 1779 forced: true, 1780 units:[ 1781 ['day',[1]] 1782 ], 1783 dateTimeLabelFormats: { 1784 day : [dateFormatDay], 1785 } 1786 } 1787 } 1788 }, 1789 1790 rangeSelector : { 1791 enabled: false 1792 }, 1793 1794 scrollbar: { 1795 enabled: false 1796 }, 1797 1798 title : { 1799 text : null 1800 }, 1801 1802 tooltip : { 1803 1804 backgroundColor: { 1805 linearGradient: { 1806 x1: 0, 1807 y1: 0, 1808 x2: 0, 1809 y2: 1 1810 }, 1811 stops: [ 1812 [0, 'white'], 1813 [1, '#EEE'] 1814 ] 1815 }, 1816 hideDelay: 1500, 1817 borderColor: 'gray', 1818 borderWidth: 1, 1819 borderRadius: 5, 1820 shared : true, 1821 split: false, 1822 headerFormat: '<span style="font-size:12px">'+aWords[1]+' : <b>{point.key}</b></span><br>', 1823 useHTML: true, 1824 dateTimeLabelFormats : { 1825 day : dateFormatDay 1826 }, 1827 style: { 1828 pointerEvents: 'auto' 1829 } 1830 }, 1831 1832 xAxis: [ 1833 { 1834 allowDecimals: false, 1835 endOnTick: false, 1836 labels: { 1837 align: 'center', 1838 style: { 1839 color: "black" 1840 }, 1841 zIndex: 5 1842 }, 1843 lineWidth: 1, 1844 lineColor: 'black', 1845 gridLineColor: "#ededed", 1846 gridLineWidth: 1, 1847 title: null, 1848 minRange: 3600*24*30*1000, 1849 tickWidth: 1, 1850 tickLength: 5, 1851 tickColor: 'black', 1852 showFirstLabel: true, 1853 crosshair: { 1854 snap: false 1855 } 1856 }, 1857 { 1858 lineWidth: 1, 1859 lineColor: "black", 1860 tickWidth: 0, 1861 linkedTo: 0, 1862 tickLength: 0, 1863 labels: { 1864 enabled: false 1865 }, 1866 offset : 0, 1867 crosshair: { 1868 snap: false 1869 } 1870 }], 1871 1872 yAxis: [{ 1873 id: "mainAxeValeurs", 1874 lineWidth: 1, 1875 gridLineColor: "#ededed", 1876 title: "variation", 1877 lineColor: 'black', 1878 maxPadding: 0.1, 1879 tickWidth: 1, 1880 tickLength: 5, 1881 tickColor: 'black', 1882 tickPixelInterval: 50, 1883 endOnTick: false, 1884 startOnTick: false, 1885 labels: { 1886 align: 'left', 1887 x: 10, 1888 style : { 1889 color: "black" 1890 } 1891 }, 1892 showLastLabel: true, 1893 type: 'logarithmic', 1894 offset: 20, 1895 crosshair: { 1896 snap: false 1897 } 1898 }, 1899 { 1900 id : 'axeVolumes', 1901 title: null, 1902 top: '85%', 1903 height: '0%', 1904 gridLineWidth: 1, 1905 gridLineColor: "#ededed", 1906 lineWidth: 1, 1907 lineColor: "black", 1908 tickWidth: 1, 1909 tickLength: 5, 1910 tickColor: 'black', 1911 offset : 20, 1912 scalable: false, 1913 labels : { 1914 align : 'left', 1915 x : 5, 1916 style: { 1917 color: "black" 1918 } 1919 }, 1920 showEmpty : false, 1921 showLastLabel: true, 1922 endOnTick: false, 1923 crosshair: { 1924 snap: false 1925 } 1926 }] 1927 }; 1928 1929 var chart = new Highcharts.StockChart(options); 1930 1931 chart.showLoading(); 1932 1933 var begin = new Date(); 1934 begin.setMonth(begin.getMonth() - 10); 1935 //begin.setFullYear(begin.getFullYear() - 1); 1936 sBegin = begin.getFullYear()+'-'+(begin.getMonth()+1)+'-'+begin.getDate(); 1937 1938 $.ajax({url : URL_SERVEUR+'atDataFeed.php', 1939 cache: false, 1940 context : document.body, 1941 async : true, 1942 data : {codeZB : codeZB, type : "chart", fields : "Date,Open,High,Low,Close", date_start: sBegin}, 1943 type : 'GET', 1944 success : function(data) 1945 { 1946 try 1947 { 1948 aDataQuote = JSON.parse(data) 1949 } 1950 catch(e) 1951 { 1952 $('#'+inDiv).css('display','none'); 1953 console.log("erreur JSON parse : "+e); 1954 console.log("data received : "+data); 1955 return; 1956 } 1957 1958 var chartSeries = { 1959 type : 'line', 1960 name : nomSoc, 1961 data : [], 1962 id : 'myValueSeries', 1963 yAxis: 0, 1964 showInLegend: false, 1965 //zIndex: 0 1966 }; 1967 1968 var now = new Date().getTime(); 1969 var i = aDataQuote.length-1; 1970 while((i>=0)&&(aDataQuote[i]['x']>(now-(3600*24*365*2*1000)))) 1971 { 1972 chartSeries.data.unshift(aDataQuote[i]); 1973 i--; 1974 } 1975 1976 // Update the chart 1977 chart.addSeries(chartSeries,true,false); 1978 1979 $.ajax({url : URL_SERVEUR+'atDataFeed.php', 1980 cache: false, 1981 context : document.body, 1982 async : true, 1983 data : {codeZB : codeZB, type : "volumes", date_start: sBegin}, 1984 type : 'GET', 1985 success : function(data) 1986 { 1987 try 1988 { 1989 aDataQuote = JSON.parse(data) 1990 } 1991 catch(e) 1992 { 1993 $('#'+inDiv).css('display','none'); 1994 console.log("erreur JSON parse : "+e); 1995 console.log("data received : "+data); 1996 return; 1997 } 1998 1999 var volumeSeries = { 2000 type : 'column', 2001 name : 'Volumes', 2002 data : [],//aDataQuote, 2003 yAxis: 'axeVolumes', 2004 id : 'volumes', 2005 tooltip: { 2006 pointFormat : '<tr><td style="padding:0;font-size:12px">{series.name}: </td><td style="padding:0;font-size:12px; text-align : right;"><b>{point.y}</b></td></tr>' 2007 }, 2008 dataGrouping: { 2009 units:[ 2010 ['day',[1]] 2011 ], 2012 dateTimeLabelFormats: { 2013 day : [dateFormatDay], 2014 week: [dateFormatWeek] 2015 } 2016 } 2017 }; 2018 2019 var now = new Date().getTime(); 2020 var i = aDataQuote.length-1; 2021 while((i>=0)&&(aDataQuote[i][0]>(now-(3600*24*365*2*1000)))) 2022 { 2023 volumeSeries.data.unshift(aDataQuote[i]); 2024 i--; 2025 } 2026 2027 if(aDataQuote.length>0) 2028 { 2029 var chart = $("#"+inDiv).highcharts(); 2030 bGotVolumes = true; 2031 chart.get('axeVolumes').update({ 2032 height: '15%', 2033 tickPixelInterval: chart.plotHeight*(0.1) 2034 }); 2035 chart.get('mainAxeValeurs').update({ 2036 height : '85%' 2037 }); 2038 chart.xAxis[1].update({ 2039 offset: -chart.plotHeight*0.15 2040 }); 2041 chart.addSeries(volumeSeries,true,true); 2042 aChartSeriesID.push(volumeSeries.id); 2043 } 2044 2045 if(typeof callback == "function") callback(); 2046 } 2047 }); 2048 2049 if(sPage=="actualites") 2050 { 2051 loadNewsFromDate(codeZB,sBegin,inDiv); 2052 loadAgendaFromDate(codeZB,sBegin,inDiv,"",0,false); 2053 } 2054 else 2055 { 2056 loadAgendaFromDate(codeZB,sBegin,inDiv,"",0,false); 2057 } 2058 }}); 2059}
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.