Things i've made

Looking for more? See a list of everything i've made.

Thursday, May 26, 2011

Cairo/Gtk Charting Widget

Updates! :
Gtk has no built-in charting capabilities. There are also no existing, fully functional charting packages for Gtk. I needed to add flexible charting capabilities to a trading platform, using Gtk, that would work on Windows, Linux, and Solaris. The goals of the charting package was to be able to chart data from anywhere in the same chart, and use the chart for user input, ie allow point to be moved round, zoom, navigate, etc.
 Gtk uses cairo as its rendering backend these days. Cairo is a vector graphics rendering package that works on a large number of platforms and is accelerated where hardware backends exist. Using cairo to render the chart makes it integrate nicely with the core of Gtk and also allow the charts to be used outside of Gtk applications, simply linking against cairo.

The flexibility in charting comes from the overall design. Each chart can have zero or more axis. Each chart can have zero or more series, with a series being tied to the axis it is plotted against. All text labels can be controlled through specialization. With this design at the core, adding new functionality, such as a new series type, or an irregular axis is a simple task.
A collage of some charting features
A non-exhaustive list of features supported by this charting package include:

  • Series types :Lines, bars, points columns, areas, candle sticks, HLOCs, bounded regions, bubbles, pie
  • Full control over text labels for axis, values, hover popups on points with the most common formatting built-in.
  • Unlimited X and Y axis on an combination of sides/top and bottom of the chart
  • Full Dynamic updates allowing changing points, adding and inserting, removing points. Changing or adding axis, series, etc
  • Saving to PDF, PS, SVG, or any other format supported by cairo.
  • User interaction so you can drag points, zoom in on regions, select points by region or clicking, hover popups showing details for the nearest point
  • Support for Gtk versions 2.4.x to 3.x, and generic applications by including cairo.
Availability and Source Code
I designed and implemented this charting package in its entirety as well as many actual application uses for trading. The code is of commercial interest and thus not available for download.

Feel free to contact me to discuss the availability of this package.


  1. The source code for GTK+ is also "of commercial interest". Nevertheless it was released under the GPL. Don't be such a parasite freeloading off the back of others. Publish the code.

  2. Hi eeqmul,

    Thanks for your feedback.

    If you could tell me what the code would be used for if it was released, i'm guessing some open source project by your attitude, then I could try to convince the current owners of the source code to consider releasing it under GPL.

  3. Hey Ryan,

    I am working on my Bachelor and have to program a gui. In this GUI I have also to plot a Graphic, but I don´t have the skills and time to program my own package like here described.

    Could you please send me the package? Or maybe you have a hint for me which one i could use.

    I am programming and using the GUI on a Windows 7 computer and programming in c. I also use Glade 3.8.3 to design the GUI.

    Pleas contact me!! (:


    Niclas Becker

  4. Oh my, you do a very impressive work here, indeed! And not just in functionality (as I can see), but in aesthetic point as well! It's awesome! Ryan, good job! So ... please, share this wonderful work with us! We need this package ... I need this package! :)

  5. Hey Ryan,

    You have really done a wonderful job!

    As you’ve said in this post, I would like to discuss the availability of this code for one of my project.

    The project is 100% personal and I will be the only one to see the result of this project. This project won’t be distributed on the internet.

    Could you contact me to discuss of the availability of this package and under what condition I could use it? My email address is

    Hope you will contact me soon!

    Have a nice day!


  6. Hey, Ryan!
    I would like to get a copy of your code. It is supposed to be used at my home automation system to display data from my solar and wind turbine controllers. I am writing this for my own use. If you consider to share, my email is vomus at rambler dot ru.

    Thank you in advance,

  7. Hi Ryan,

    I would like to discuss different licensing options with you, for the charting components. Please drop me an email at pcherenkov (at) gmail, thank you.

    Best regards,


Note: Only a member of this blog may post a comment.