Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. onClick: function (e) {
  2.                 var element = this.getElementAtEvent(e);
  3.                 var activePoints = myChart.getElementsAtEventForMode(e, 'point', myChart.options);
  4.                 var firstPoint = activePoints[0];
  5.                 var label = myChart.data.labels[firstPoint._index];
  6.                
  7.                 if (label.substr(0,3) == "Fil") $("#myChart").css("background","url(images/highlight1.png)");
  8.                 else if (label.substr(0,3) == "Lan") $("#myChart").css("background","url(images/highlight2.png)");
  9.                 else if (label.substr(0,3) == "Por") $("#myChart").css("background","url(images/highlight3.png)");
  10.                 else if (label.substr(0,3) == "Spo") $("#myChart").css("background","url(images/highlight4.png)");
  11.                 else if (label.substr(0,3) == "Str") $("#myChart").css("background","url(images/highlight5.png)");
  12.                
  13.                 var cameraname = $('.camera-id').text();
  14.                 //$('#myChart').fadeOut();
  15.                 $('#feature-recommendation-modes').fadeOut();
  16.                 //$('#graph-intro').fadeOut();
  17.                 $('#mode-to-camera-comparison-detail').html("<button class='btn btn-primary mr-4' onclick='goBackToChart();'><i class='fa fa-chevron-left' aria-hidden='true'></i><span class='ml-3'>Close</span></button>");
  18.                 $('#mode-to-camera-comparison-detail').append(label + " for camera <span style='color:blue'>" + cameraname + "</span>");
  19.                 $.get("getCameraFeaturesModeComparison.php", {
  20.                     camera: cameraname,
  21.                     mode: label.replace(' ', '_')
  22.                 })
  23.                
  24.                 .done(function (data) {
  25.                     var parsedData = JSON.parse(data);
  26.                     var k = 0;
  27.                     var availability;
  28.                     var table = "<table class='table table-striped table-hover text-center mt-2'><thead class='p-1'><tr><th scope='col'>Feature</th><th scope='col'>" + label + "</th><th scope='col'>" + cameraname + "</th><th>Availability</th></thead>";
  29.                     table += "<tbody>";
  30.                     $.each(parsedData, function (i, item) {
  31.                         if (i == 'video_highest_resolution') {
  32.                             if (item['camera'] == '1920 x 1080 pixel' || item['camera'] == '3840 x 2160 pixel' || item['camera'] == '4096 x 2160 pixel') {
  33.                                 availability = '<i class="fa fa-check" aria-hidden="true" style="color: green"></i>';
  34.                             } else {
  35.                                 availability = '<i class="fa fa-times" aria-hidden="true" style="color: red"></i>';
  36.                             }
  37.                             table += "<tr><th scope='row' class='hint--medium hint--bottom' aria-label='"+item['explanation']+"'>"+ i.replace(/_/g, " ").toUpperCase() + "   &#9432;</th><td>" + item['mode_min']+ " - " + item['mode_max'] + "</td><td>" + item['camera'] + "</td><td>" + availability + "</td></tr>";
  38.  
  39.                         }
  40.                         else if (typeof(item['mode_min']) == 'undefined') {
  41.                             if (item['mode'] == item['camera']) {
  42.                                 availability = '<i class="fa fa-check" aria-hidden="true" style="color: green"></i>';
  43.                             } else {
  44.                                 availability = '<i class="fa fa-times" aria-hidden="true" style="color: red"></i>';
  45.                             }
  46.                             table += "<tr><th scope='row' class='hint--medium hint--bottom' aria-label='"+item['explanation']+"'>"+ i.replace(/_/g, " ").toUpperCase() + "  &#9432;</th><td>" + item['mode'] + "</td><td>" + item['camera'] + "</td><td>" + availability + "</td></tr>";
  47.                         }
  48.                     else {
  49.                             if ((parseFloat(item['mode_min']) < parseFloat(item['camera']) && parseFloat(item['mode_max']) < parseFloat(item['camera'])) || (parseFloat(item['mode_min']) > parseFloat(item['camera']) && parseFloat(item['mode_max']) > parseFloat(item['camera']))) {
  50.                                 availability = '<i class="fa fa-times" aria-hidden="true" style="color: red"></i>'
  51.                             } else {
  52.                                 availability = '<i class="fa fa-check" aria-hidden="true" style="color: green"></i>';
  53.  
  54.                             }
  55.                             table += "<tr><th scope='row' class='hint--medium hint--bottom' aria-label='"+item['explanation']+"'>"+ i.replace(/_/g, " ").toUpperCase() + "   &#9432;</th><td>" + item['mode_min']+ " - " + item['mode_max'] + "</td><td>" + item['camera'] + "</td><td>" + availability + "</td></tr>";
  56.  
  57.                         }});
  58.                     table += "</tbody></table>";
  59.                     $('#mode-to-camera-comparison-detail').append(table);
  60.                 });
  61.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement