Untitled

 avatar
unknown
plain_text
2 years ago
7.2 kB
4
Indexable
 <script type="text/javascript">                       

 // Calculate the step size   300 Panic Price, 700 Losst Trigger Price, 850 Win Trigger Price, 620 Coin price
 const CoinPrice<?php echo "$CoinSymbol"; ?> = document.getElementById("CoinPrice-<?php echo "$CoinSymbol"; ?>").getAttribute("data-Price");                                                                     
 const WinTriggerPrice<?php echo "$CoinSymbol"; ?> = document.getElementById("WinTriggerPrice-<?php echo "$CoinSymbol"; ?>").value;
 const LossTriggerPrice<?php echo "$CoinSymbol"; ?> = document.getElementById("LossTriggerPrice-<?php echo "$CoinSymbol"; ?>").value;
 const PanicPrice<?php echo "$CoinSymbol"; ?> = document.getElementById("PanicPrice-<?php echo "$CoinSymbol"; ?>").value;
//console.log("Coin Price :"+CoinPrice<?php echo "$CoinSymbol"; ?>+", WinTriggerPrice :"+WinTriggerPrice<?php echo "$CoinSymbol"; ?>+",LossTriggerPrice :"+LossTriggerPrice<?php echo "$CoinSymbol"; ?>+", PanicPrice :"+PanicPrice<?php echo "$CoinSymbol"; ?>);
let step<?php echo "$CoinSymbol"; ?> = (WinTriggerPrice<?php echo "$CoinSymbol"; ?> - PanicPrice<?php echo "$CoinSymbol"; ?>) / 11;
// Initialize values array
let z<?php echo "$CoinSymbol"; ?> = step<?php echo "$CoinSymbol"; ?>.toFixed(4);
//console.log(z);
const values<?php echo "$CoinSymbol"; ?> = [];
for (let i = 0; i <= 11; i++) {
    values<?php echo "$CoinSymbol"; ?>.push(PanicPrice<?php echo "$CoinSymbol"; ?> + i * z<?php echo "$CoinSymbol"; ?> );
}
window.feed = function (callback) {
    var tick = {};
    tick.plot0 = values<?php echo "$CoinSymbol"; ?>[Math.floor(Math.random() * values<?php echo "$CoinSymbol"; ?>.length)];
    callback(JSON.stringify(tick));
};
const myChart<?php echo "$CoinSymbol"; ?> = document.getElementById("myChart-<?php echo "$CoinSymbol"; ?>");
//const cells = table.getElementsByTagName("fieldset");
//console.log(myChart<?php echo "$CoinSymbol"; ?>.id);
var myConfig = {
    type: "gauge",
        backgroundColor: false,

    globals: {color:'white',
        fontSize: 15
    },
    plotarea: {
        marginTop: 80
    },
    plot: {
        size: '100%',
        valueBox: {
            placement: 'center',
            text: '%v',
            fontSize: 35,
            rules: [
                {
                    rule: '%v >= '+LossTriggerPrice<?php echo "$CoinSymbol"; ?>+'',
                    text: '%v<br>Safe Zone',
                    
                    backgroundColor: '#29B6F6',
                },
                {
                    rule: '%v <  '+LossTriggerPrice<?php echo "$CoinSymbol"; ?>+'',
                    text: '%v<br>Loss Triggered',
                    backgroundColor: '#E53935',
                }
            ]
        }
    },
    tooltip: {
        borderRadius: 5
    },
    scaleR: {
        aperture: 180,
        minValue: PanicPrice<?php echo "$CoinSymbol"; ?>,
        maxValue: WinTriggerPrice<?php echo "$CoinSymbol"; ?>,
        z<?php echo "$CoinSymbol"; ?> : 50,
        center: {
            visible: false
        },
        tick: {
            visible: false
        },
        item: {
            offsetR: 0,
            rules: [
                {
                    rule: '%i == 11',
                    offsetX: 15
                }
            ]
        },
        labels: values<?php echo "$CoinSymbol"; ?>,
        ring: {
            size: 50,
            rules: [
                {
                    rule: '%v <= '+LossTriggerPrice<?php echo "$CoinSymbol"; ?>+'',
                    backgroundColor: '#E53935'
                },
                {
                    rule: '%v >= '+LossTriggerPrice<?php echo "$CoinSymbol"; ?>+'',
                    backgroundColor: '#29B6F6'
                }
            ]
        }
    },
    refresh: {
        type: "feed",
        transport: "js",
        url: "feed()",
        interval: 2000,
        resetTimeout: 1000
    },
    series: [
        {
            values<?php echo "$CoinSymbol"; ?>: [CoinPrice<?php echo "$CoinSymbol"; ?>],
            backgroundColor: 'black',
            indicator: [10, 10, 10, 10, 0.75],
            animation: {
                effect: 2,
                method: 1,
                sequence: 4,
                speed: 9000
            },
        }
    ]
};


zingchart.render({
    id: myChart<?php echo "$CoinSymbol"; ?>.id,
    data: myConfig,
    height: 500,color:'white',
    width: '100%'
});

</script> 


 <script type="text/javascript">
                                    /*
$(document).ready(function(){
 $('#del').click(function(){
  var CoinSymbol = $('#CoinSymbol').val();
  if($.trim(CoinSymbol) != '')
  {
   $.ajax({
    url:"post.php",
    method:"POST",
    data:{CoinSymbol:CoinSymbol},
    dataType:"text",
    success:function(data)
    {
     $('#CoinSymbol').val("");
    }
   });
  }
 });
 */
// setInterval(function(){//setInterval() method execute on every interval until called clearInterval()
//  $('#load_posts').load("home.php").fadeIn("slow");
  //load() method fetch data from fetch.php page
 //}, 500);
 
/*});*/

                                    /*
                     $(document).ready(function(){

                                      sendRequest();
                                        var x=5;
                                      function sendRequest(){
                                          $.ajax({
                                            url: "home.php",
                                            success: 
                                              function(data){
                                               // alert(x);
                                               //$('#listposts').html(data); //insert text of test.php into your div
                                               //$('#Timer').val(x);
                                            },

                                            complete: function() {
                                              //  $('#Timer').val(x++);
                                           // Schedule the next request when the current one's complete
                                           setInterval(sendRequest, 10000); // The interval set to 5 seconds
                                         }

                                        });

                                      };

                                    });
                                    function loadlink(){
                                            $('#Timer').load('home.php',function () {
                                                 $(this).unwrap();
                                            });
                                        }

                                        loadlink(); // This will run on page load
                                        setInterval(function(){
                                            loadlink() // this will run after every 5 seconds
                                        }, 10000);*/
                                    </script>
Editor is loading...