Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Layers Pattern in Practice

, 23 Apr 2010
Layers Pattern via a WPF project.
AdditionalDependencies.zip
BillsManager.zip
BillsManager
BillManagerUninstallAction
Properties
BillPayManager
Application.ico
BillPayManager.cd
BillPayManager.csproj.user
bin
Debug
AvalonControlsLibrary.dll
System.Windows.Controls.DataVisualization.Toolkit.dll
WPFToolkit.dll
WPFVisifire.Charts.dll
Charting
DataGrid
icon.ico
Images
about.png
archive.png
backArrow.png
bills.png
charts.png
fwdArrow.png
icon.ico
settings.png
Properties
Themes
BillPayManager.suo
BillsBusinessLogicLib
BillsBusinessLogicLib.csproj.user
BLLBills.cd
ciumac.sergiu.pfx
Properties
BillsDalLib
BillsDalClassDiagram.cd
BillsDalLib.csproj.user
ciumac.sergiu.pfx
DALSchema
Properties
BillsEntityLib
BillEntityClassDiagram.cd
BillsEntityLib.csproj.user
ciumac.sergiu.pfx
Properties
SetupBillPayManager
SetupBillPayManager.vdproj
TestBillPayManager
Properties
TestBillPayManager.csproj.user
TestBillPayManagerManual
AddBillManualTest.mht
DeleteBill.mht
Properties
Release.zip
en-US
BillPayManager.resources.dll
ro-RO
BillPayManager.resources.dll
ReleaseSetup.zip
using System.Collections.Generic;
using System.Linq;
using Visifire.Charts;

namespace BillPayManager.Charting
{
    /// <summary>
    /// Charting tool
    /// </summary>
    public class LineCharting : ICharting
    {
        #region ICharting
        /// <summary>
        /// Gets Chart Title
        /// </summary>
        /// <param name="name">Name of the chart</param>
        /// <returns>Title object</returns>
        public Title GetTitle(string name)
        {
            Title title = new Title {Text = name};
            return title;
        }
        /// <summary>
        /// Get chart axis
        /// </summary>
        /// <param name="type">Type of the interval</param>
        /// <param name="list">List</param>
        /// <returns>Axis object</returns>
        public Axis GetAxis(IntervalTypes type, IEnumerable<BillsEntityLib.Bill> list)
        {
            // Create a new Axis
            Axis axis = new Axis {IntervalType = type, Interval = (list == null) ? 0 : list.Count()};
            return axis;
        }

        /// <summary>
        /// Get data series object
        /// </summary>
        /// <param name="list">List of bills</param>
        /// <param name="valueType">Chart value type</param>
        /// <returns>DataSeries object</returns>
        public DataSeries GetDataSeries(IEnumerable<BillsEntityLib.Bill> list, ChartValueTypes valueType)
        {
            // Create a new instance of DataSeries
            DataSeries dataSeries = new DataSeries {RenderAs = RenderAs.Line, XValueType = valueType};

            if (list == null)
                return dataSeries;
            foreach (BillsEntityLib.Bill bill in list)
            {
                // Create a new instance of DataPoint
                DataPoint dataPoint = new DataPoint {XValue = bill.AddedOn, YValue = (double) bill.Amount};

                // Set XValue for a DataPoint

                // Set YValue for a DataPoint

                // Add dataPoint to DataPoints collection
                dataSeries.DataPoints.Add(dataPoint);
            }

            return dataSeries;
        }
        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Ciumac Sergiu
Software Developer
Moldova (Republic Of) Moldova (Republic Of)
Interested in computer science, math, research, and everything that relates to innovation. Fan of agnostic programming, don't mind developing under any platform/framework if it explores interesting topics. In search of a better programming paradigm.
Follow on   Twitter   LinkedIn

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 23 Apr 2010
Article Copyright 2010 by Ciumac Sergiu
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid