Giter VIP home page Giter VIP logo

speedtestergauge's Introduction

Speed Test Visualized with Gauge Plot

Basic Usage

!pip install speedtest-cli

import speedtest
# Create object
test = speedtest.Speedtest()

# Perform download, upload, and ping tests 
print("Performing Download Test..")
down_result = test.download()

print("Performing Upload Test..")
up_result = test.upload()

print("Performing Ping Test..")
ping_result = test.results.ping

Creating Gauge Plot with Plotly

This is the basic usage, see the code for tweaks..

fig = go.Figure(go.Indicator(
    domain = {'x': [0, 1], 'y': [0, 1]},
    value = down_result/(1024*1024),
    mode = "gauge+number+delta",
    title = {'text': "Download Speed (Mbps)"},
    delta = {'reference': 50},  
    gauge = {'axis': {'range': [None, 100]},
             'bar': {'color':"#4c5a58"},
             'borderwidth': 2,
             'bordercolor': "gray",
             'shape':'angular', 
             'steps' : [
                 {'range': [0, 20], 'color': "#ffb961"},
                 {'range': [20, 40], 'color': "#f3826f"},
                 {'range': [40, 60], 'color': "#c05c7e"},
                 {'range': [60, 80], 'color': "#722d61"},
                 {'range': [80, 100], 'color': "#2d3561"}],
             'threshold' : {'line': {'color': "crimson", 'width': 4}, 'thickness': 0.75, 'value': 50}}))

fig.update_layout(paper_bgcolor = "#f5f0b8")

Output

Creating Gauge Plot with PyGal

This is the basic usage, see the code for tweaks..

!pip install pygal

from pygal import SolidGauge

Solid_Gauge = SolidGauge(inner_radius = 0.75, 
                               half_pie = True,
                               style=LightSolarizedStyle)
  
# Name
Solid_Gauge.title = 'Speed Test'     
  
# Add test results to gauge
Solid_Gauge.add('Download', [{'value': round(down_result/(1024*1024),2), 'max_value': 100, 'label':'Download (Mbps)'}])
Solid_Gauge.add('Upload', [{'value': round(up_result/(1024*1024),2), 'max_value': 50, 'label':'Upload (Mbps)'}])
Solid_Gauge.add('Ping', [{'value': round(ping_result,2), 'max_value': 50,    'label':'Ping (ms)'}])

# Save or render in browser (interactive)
#Solid_Gauge.render_to_png('pygal_result.png', dpi = 300)
Solid_Gauge.render_in_browser()

Output

speedtestergauge's People

Contributors

kemalakin avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

chandpes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.