Awesome Open Source
Awesome Open Source

CI

alt text
Logo Created By @stsdc
A simple Cairo Chart Library for GTK and Vala

Caroline is a simple and light interface into Cairo allowing a developer to create a chart in just a few lines of code! Below is some screenshots of what you can do with it currently. Also below is a road map, documentation, and some ramblings about the development process and inner-workings of Cairo and Caroline!

Getting Started

Compiling & Installing

mkdir build
cd build
meson ..
ninja
sudo ninja install

You now have a linked library that can be accessed by your app!

Simple Usage

A sample application called "Sample.vala" is included in this repo, it contains a simple application to show off how Caroline works. Below is a bare-bones example of how to interface with Caroline.

var carolineWidget = new Caroline.without_colors (
  x, //dataX
  yArray, //dataY
  chartTypes, //chart types
  true, //yes or no for generateColors function (needed in the case of the pie chart),
  true, //true for generating hue based colors, and false for random colors
  false // yes or no for scatter plot labels
);

or generate your own colors:

ArrayList<Caroline.ChartColor?> chartColorArray = new ArrayList<Caroline.ChartColor?> ();

for (int i = 0; i < cArray.length; i++){

  //Create color struct
  Caroline.ChartColor chartColor = {
    Random.double_range(0,1),
    Random.double_range(0,1),
    Random.double_range(0,1)
  };

  chartColorArray.insert (i, chartColor);

}

var carolineWidget = new Caroline.with_colors (
  x, //dataX
  yArray, //dataY
  chartColorArray,
  false, //yes or no for generateColors function (needed in the case of the pie chart),
  false, //true for generating hue based colors, and false for random colors
  false // yes or no for scatter plot labels
);

This is how we generate a simple line chart. See the full sample application to learn more.

Caroline Documentation

Check out the code! It has lots of detailed documentation and try using the Sample.vala file. Chart types are now bar, line, smooth-line, scatter, and pie.


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Chart (2,239
Widget (1,857
Vala (1,351
Gtk (858
Line (523
Elementaryos (199
Bar (171
Related Projects