SharpPlot Tutorials > General Tutorials > Sample datasets supplied as XML

Sample datasets supplied as XML

Several simple databases are included with the SharpPlot distribution to allow you to experiment with grouping and splitting data. The smallest of these is an invented Sales Information database with two products and some monthly figures:

Products Table
==============
 
 Column Name   Data Type      Allow Null  Unique 
 -----------   ---------      ----------  ------ 
 Product Id    System.String           0       1 
 Product Name  System.String           1       0 
 
Sales Table
===========
 
 Column Name  Data Type        Allow Null  Unique 
 -----------  ---------        ----------  ------ 
 Date         System.DateTime           0       0 
 Year         System.Int32              1       0 
 Month        System.String             1       0 
 Quarter      System.String             1       0 
 Product      System.String             0       0 
 Sales        System.Int32              1       0 

There are two products, and 30 entries in the sales information.

The XML souce is:

<?xml version="1.0" standalone="yes"?>
<Sales_x0020_Information>
  <xs:schema id="Sales_x0020_Information" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xs:element name="Sales_x0020_Information" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
      <xs:complexType>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="Products">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="Product_x0020_Id" type="xs:string" />
                <xs:element name="Product_x0020_Name" type="xs:string" minOccurs="0" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
          <xs:element name="Sales">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="Date" type="xs:dateTime" />
                <xs:element name="Year" type="xs:int" minOccurs="0" />
                <xs:element name="Month" type="xs:string" minOccurs="0" />
                <xs:element name="Quarter" type="xs:string" minOccurs="0" />
                <xs:element name="Product" type="xs:string" />
                <xs:element name="Sales" type="xs:int" minOccurs="0" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
      <xs:unique name="Constraint1" msdata:PrimaryKey="true">
        <xs:selector xpath=".//Products" />
        <xs:field xpath="Product_x0020_Id" />
      </xs:unique>
      <xs:unique name="Sales_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
        <xs:selector xpath=".//Sales" />
        <xs:field xpath="Date" />
        <xs:field xpath="Product" />
      </xs:unique>
      <xs:keyref name="Distribution" refer="Constraint1">
        <xs:selector xpath=".//Sales" />
        <xs:field xpath="Product" />
      </xs:keyref>
    </xs:element>
  </xs:schema>
  <Products>
    <Product_x0020_Id>KK</Product_x0020_Id>
    <Product_x0020_Name>Kit Kat</Product_x0020_Name>
  </Products>
  <Products>
    <Product_x0020_Id>QS</Product_x0020_Id>
    <Product_x0020_Name>Quality Street</Product_x0020_Name>
  </Products>
  <Sales>
    <Date>2005-01-01T00:00:00+00:00</Date>
    <Year>2005</Year>
    <Month>Jan</Month>
    <Quarter>Q1</Quarter>
    <Product>KK</Product>
    <Sales>341</Sales>
  </Sales>
  <Sales>
    <Date>2005-02-01T00:00:00+00:00</Date>
    <Year>2005</Year>
    <Month>Feb</Month>
    <Quarter>Q1</Quarter>
    <Product>KK</Product>
    <Sales>482</Sales>
  </Sales>
  <Sales>
    <Date>2005-03-01T00:00:00+00:00</Date>
    <Year>2005</Year>
    <Month>Mar</Month>
    <Quarter>Q1</Quarter>
    <Product>KK</Product>
    <Sales>467</Sales>
  </Sales>
  <Sales>
    <Date>2005-04-01T00:00:00+01:00</Date>
    <Year>2005</Year>
    <Month>Apr</Month>
    <Quarter>Q2</Quarter>
    <Product>KK</Product>
    <Sales>403</Sales>
  </Sales>
  <Sales>
    <Date>2005-05-01T00:00:00+01:00</Date>
    <Year>2005</Year>
    <Month>May</Month>
    <Quarter>Q2</Quarter>
    <Product>KK</Product>
    <Sales>325</Sales>
  </Sales>
  <Sales>
    <Date>2005-06-01T00:00:00+01:00</Date>
    <Year>2005</Year>
    <Month>Jun</Month>
    <Quarter>Q2</Quarter>
    <Product>KK</Product>
    <Sales>302</Sales>
  </Sales>
  <Sales>
    <Date>2005-07-01T00:00:00+01:00</Date>
    <Year>2005</Year>
    <Month>Jul</Month>
    <Quarter>Q3</Quarter>
    <Product>KK</Product>
    <Sales>287</Sales>
  </Sales>
  <Sales>
    <Date>2005-08-01T00:00:00+01:00</Date>
    <Year>2005</Year>
    <Month>Aug</Month>
    <Quarter>Q3</Quarter>
    <Product>KK</Product>
    <Sales>290</Sales>
  </Sales>
  <Sales>
    <Date>2005-09-01T00:00:00+01:00</Date>
    <Year>2005</Year>
    <Month>Sep</Month>
    <Quarter>Q3</Quarter>
    <Product>KK</Product>
    <Sales>318</Sales>
  </Sales>
  <Sales>
    <Date>2005-10-01T00:00:00+01:00</Date>
    <Year>2005</Year>
    <Month>Oct</Month>
    <Quarter>Q4</Quarter>
    <Product>KK</Product>
    <Sales>371</Sales>
  </Sales>
  <Sales>
    <Date>2005-11-01T00:00:00+00:00</Date>
    <Year>2005</Year>
    <Month>Nov</Month>
    <Quarter>Q4</Quarter>
    <Product>KK</Product>
    <Sales>403</Sales>
  </Sales>
  <Sales>
    <Date>2005-12-01T00:00:00+00:00</Date>
    <Year>2005</Year>
    <Month>Dec</Month>
    <Quarter>Q4</Quarter>
    <Product>KK</Product>
    <Sales>497</Sales>
  </Sales>
  <Sales>
    <Date>2006-01-01T00:00:00+00:00</Date>
    <Year>2006</Year>
    <Month>Jan</Month>
    <Quarter>Q1</Quarter>
    <Product>KK</Product>
    <Sales>383</Sales>
  </Sales>
  <Sales>
    <Date>2006-02-01T00:00:00+00:00</Date>
    <Year>2006</Year>
    <Month>Feb</Month>
    <Quarter>Q1</Quarter>
    <Product>KK</Product>
    <Sales>480</Sales>
  </Sales>
  <Sales>
    <Date>2006-03-01T00:00:00+00:00</Date>
    <Year>2006</Year>
    <Month>Mar</Month>
    <Quarter>Q1</Quarter>
    <Product>KK</Product>
    <Sales>512</Sales>
  </Sales>
  <Sales>
    <Date>2006-04-01T00:00:00+01:00</Date>
    <Year>2006</Year>
    <Month>Apr</Month>
    <Quarter>Q2</Quarter>
    <Product>KK</Product>
    <Sales>378</Sales>
  </Sales>
  <Sales>
    <Date>2006-05-01T00:00:00+01:00</Date>
    <Year>2006</Year>
    <Month>May</Month>
    <Quarter>Q2</Quarter>
    <Product>KK</Product>
    <Sales>328</Sales>
  </Sales>
  <Sales>
    <Date>2006-06-01T00:00:00+01:00</Date>
    <Year>2006</Year>
    <Month>Jun</Month>
    <Quarter>Q2</Quarter>
    <Product>KK</Product>
    <Sales>297</Sales>
  </Sales>
  <Sales>
    <Date>2005-01-01T00:00:00+00:00</Date>
    <Year>2005</Year>
    <Month>Jan</Month>
    <Quarter>Q1</Quarter>
    <Product>QS</Product>
    <Sales>173</Sales>
  </Sales>
  <Sales>
    <Date>2005-02-01T00:00:00+00:00</Date>
    <Year>2005</Year>
    <Month>Feb</Month>
    <Quarter>Q1</Quarter>
    <Product>QS</Product>
    <Sales>82</Sales>
  </Sales>
  <Sales>
    <Date>2005-03-01T00:00:00+00:00</Date>
    <Year>2005</Year>
    <Month>Mar</Month>
    <Quarter>Q1</Quarter>
    <Product>QS</Product>
    <Sales>313</Sales>
  </Sales>
  <Sales>
    <Date>2005-04-01T00:00:00+01:00</Date>
    <Year>2005</Year>
    <Month>Apr</Month>
    <Quarter>Q2</Quarter>
    <Product>QS</Product>
    <Sales>67</Sales>
  </Sales>
  <Sales>
    <Date>2005-10-01T00:00:00+01:00</Date>
    <Year>2005</Year>
    <Month>Oct</Month>
    <Quarter>Q4</Quarter>
    <Product>QS</Product>
    <Sales>102</Sales>
  </Sales>
  <Sales>
    <Date>2005-11-01T00:00:00+00:00</Date>
    <Year>2005</Year>
    <Month>Nov</Month>
    <Quarter>Q4</Quarter>
    <Product>QS</Product>
    <Sales>217</Sales>
  </Sales>
  <Sales>
    <Date>2005-12-01T00:00:00+00:00</Date>
    <Year>2005</Year>
    <Month>Dec</Month>
    <Quarter>Q4</Quarter>
    <Product>QS</Product>
    <Sales>617</Sales>
  </Sales>
  <Sales>
    <Date>2006-01-01T00:00:00+00:00</Date>
    <Year>2006</Year>
    <Month>Jan</Month>
    <Quarter>Q1</Quarter>
    <Product>QS</Product>
    <Sales>98</Sales>
  </Sales>
  <Sales>
    <Date>2006-02-01T00:00:00+00:00</Date>
    <Year>2006</Year>
    <Month>Feb</Month>
    <Quarter>Q1</Quarter>
    <Product>QS</Product>
    <Sales>12</Sales>
  </Sales>
  <Sales>
    <Date>2006-03-01T00:00:00+00:00</Date>
    <Year>2006</Year>
    <Month>Mar</Month>
    <Quarter>Q1</Quarter>
    <Product>QS</Product>
    <Sales>67</Sales>
  </Sales>
  <Sales>
    <Date>2006-04-01T00:00:00+01:00</Date>
    <Year>2006</Year>
    <Month>Apr</Month>
    <Quarter>Q2</Quarter>
    <Product>QS</Product>
    <Sales>267</Sales>
  </Sales>
  <Sales>
    <Date>2006-05-01T00:00:00+01:00</Date>
    <Year>2006</Year>
    <Month>May</Month>
    <Quarter>Q2</Quarter>
    <Product>QS</Product>
    <Sales>28</Sales>
  </Sales>
</Sales_x0020_Information>

See also ...

Grouping and Splitting database data


Send comments on this topic
© Dyalog Ltd 2021