I am reading a Python book and one of the examples shows this cool way to dynamically render data from a file using a Python module called gdchart. I tried to install this with pip and easy_install on an Ubuntu machine and an OS-X machine and it failed every time!
I did a few searches using Google and did not come up with anything really. I saw something that looks similar on the PyPi site here: https://pypi.python.org/pypi/fullChart/0.1.a
This web-page from Ubuntu also looks like it may have some useful information: http://packages.ubuntu.com/lucid/python-gd
However, when I run the command sudo apt-get install python-gd I receive an error saying that this cannot be installed because of one reason or another. Here is the exact error message:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-gdchart is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python-gdchart' has no installation candidate
Does anyone know how to install this module, gdchart?
Here is the source-code I am trying to run that uses it:
#! /usr/bin/env python
import gdchart
import shelve
shelve_file = shelve.open('access.s')
items_list = [(i[1], i[0]) for i in shelve_file.items()]
items_list.sort()
bytes_sent = [i[0] for i in items_list]
#ip address = [i[1] for i in items_list]
ip_addresses = ['XXX.XXX.XXX.XXX' for i in items_list]
chart = gdchart.Bar()
chart.width = 400
chart.height = 400
chart.bg_color = 'white'
chart.plot_color = 'black'
chart.xtitle = "IP Address"
chart.ytitle = "Bytes Sent"
chart.title = "Usage by IP Address"
chart.setData(bytes_sent)
chart.setLabels(ip_addresses)
chart.draw("bytes_ip_bar.png")
shelve_file.close()