Skip to content

Instantly share code, notes, and snippets.

@busterroni
Last active March 19, 2016 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save busterroni/1961b99ba33a67422e16 to your computer and use it in GitHub Desktop.
Save busterroni/1961b99ba33a67422e16 to your computer and use it in GitHub Desktop.
import json, plotly.plotly as plotly
with open("tagpromatches.json") as f:
data=json.load(f)
radius=0
segment=0
origin=0
pi=0
sphere=0
orbit=0
curve=0
centra=0
chord=0
diameter=0
arc=0
maptest=0
maptest2=0
maptest3=0
oceanic=0
bots=0
tangent=0
for match in data.values():
server=match['server']
if "radius" in server:
radius+=1
elif "segment" in server:
segment+=1
elif "origin" in server:
origin+=1
elif "pi" in server:
pi+=1
elif "sphere" in server:
sphere+=1
elif "orbit" in server:
orbit+=1
elif "curve" in server:
curve+=1
elif "centra" in server:
centra+=1
elif "chord" in server:
chord+=1
elif "diameter" in server:
diameter+=1
elif "arc" in server:
arc+=1
elif "maptest2" in server:
maptest2+=1
elif "maptest3" in server:
maptest3+=1
elif "maptest" in server:
maptest+=1
elif "oceanic" in server:
oceanic+=1
elif "bots" in server:
bots+=1
elif "tangent" in server:
tangent+=1
else:
print "Server %s not counted" % server
fig= {
'data': [{
'labels': ['Radius', 'Segment', 'Origin', 'Pi', 'Sphere', 'Orbit', 'Curve', 'Centra', 'Chord', 'Diameter', 'Arc', 'Maptest', 'Maptest 2', 'Maptest 3', 'Oceanic', 'Bots'],
'values': [radius, segment, origin, pi, sphere, orbit, curve, centra, chord, diameter, arc, maptest, maptest2, maptest3, oceanic, bots],
'type': 'pie',
}],
'layout': {'title': 'TagPro Server Distribution'}
}
plotly.plot(fig)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment