Data Sources

Introduction

Data visualization feeds on data, and this data is provided by various data sources. Depending on the case, such an originating data source may be a relational database, a file of some sort, a standalone application, shared software component, or almost anything else. The type and structure of the data will also vary, depending on the nature of the data source and other factors. All in all, real world data comes in all sizes and shapes, and it is an important and challenging task to sort out this data, and make it uniform enough so that a single visualization tool like Davisor Chart can make sense out of it. The tool and concept that comes into rescue here is Davisor Chart Importer Data Source.

Importer Data Sources

A Davisor Chart Importer Data Source (or just a data source for short) is a software component that serves data in a consistent and uniform way to the Davisor Chart. The details of where the data is originally coming from and how it was fetched from there are all handled by the data source, and so that when visualization occurs, original data source specific details are not a consern of the visualization generator component, anymore. To summarize, a Davisor Chart Importer Data Source reads data from some external source, organizes it into an uniform and predictable form, and then serves that data forward in a well organized, standard stream of information.

Davisor Chart currently supports the following importer data sources that can read and forward data from the following kind of general use data repositories:

It is also possible to write your own custom importer data sources to access data that is in some proprietary or for some other reason unsupported format.

Processor Data Sources

Next to the importer data sources that read data from some outside source, Davisor Chart defines also a number of data processors that read data from any other Davisor data source, process and modify the data in some way, and then serve the result in exactly the same manner as any other data source. This general principle of data source chaining provides a good platform for data pre-prosessing, which is another important data visualization tool and concept.

Throughout this guide, the term data source will be used to refer collectively to all types of Davisor Chart data sources. When it is important to make a distiction between the data sources that read data from some external source and those that just refine data into a new form, the data sources that read data from somewhere else are called adaptor data sources, and those that read data from other data sources are called processor data sources, respectively.

Davisor Chart provides currently the following processor data sources:

Examples

Before going any further into the realms of data sources and processors, a simple example is in order. This example demonstrates how the complex chain of data fetching, organization, and visualization are made simple and easy with Davisor data sources. This example uses a simple CSV file as the principal data source. Although CSV files are probably simpler that the other data repositories Davisor Chart support, rest assured that all the other data sources work just as well and intuitively as the simple CSV data source used in this example.

The data we want to visualize rests initially in a simple text file that defines triplets of two decimal values and one string. The values in the triplets are separated with space characters, while the triplets themselves are separated from each other with newline characters. This is a typical example of a CSV file that separates groups of data values with one separator character, and the data values within the groups with another separator character.

The full content of our example input file is:

10.2 5.2 mon
13.8 2.5 tue
11.3 3.6 wed

To read this data, we use a CSV data source to which we tell from where the data file can be found, and how we want it's content to be organized:

<data>
  <csv source="work.txt">
    <csvColumn column="3" id="col3" type="label"/>
    <csvColumn column="1" id="col1" type="value"/>
    <csvColumn column="2" id="col2" type="value"/>
  </csv>
<data>

This configuration tells that we expect to find three columns from the "work.txt" source data file:

We also need to tell which column is which, and since a CSV data file can not offer any other column identification method than an implicit integer value column index that starts from column index value "1", we use that information to tell that the two first columns in the original file are the two value columns, and that the last one is the label column. We also associate symbolic column identities to the three columns so that we can later refer to them in more convenient and safe way (this is recommended but not strictly necessary because we could still always refer to the columns by their column index numbers, too, as long as we would remember to use the order they appear in the data source definition, instead of the order they originally appear in the file).

We now have the data source defined. We will next define some simple chart visualization attributes, and then we are set to construct a chart from the imported data:

<attributes chartType="column">
  <plot>
    <series idRef="col1" paint="red" name="work" />
    <series idRef="col2" paint="green" name="free" cumulative="true" />
  </plot>
  <legend hidden="false"/>
</attributes>

Here we tell that we want to create a column chart out of our example data, with the values from the first data column painted with red color, and the values from the second column painted with green. We would also like to state that the values in the first column form a series of data to which we want to give the name "work", and for the second series, the name "free". Finally, we want that the second column values should be accumulated with the values of the previous column, and that we would like the chart to display a default legend next to the actual chart.

By combining the two configurations, we end up with a complete chart XML configuration:

<chart>
  <data>
    <csv source="work.txt" >
      <csvColumn column="1" id="col1"/>
      <csvColumn column="2" id="col2"/>
      <csvColumn column="3" id="col3" type="label"/>
    </csv>
  </data>
  <attributes chartType="column">
    <plot>
      <series idRef="col1" paint="red" name="work" />
      <series idRef="col2" paint="green" name="free" cumulative="true" />
    </plot>
    <legend/>
  </attributes>
</chart>

After applying the configuration and data for Davisor Chart, we get the following chart image:

Chart representation of the given example data and attributes.

You can now tweak the resulting image in million different ways, as described in the Chart Attributes chapter. In particular, you may go wild immediately, and open this example in Davisor Chart Designer by pressing the button.