ShapeMarker.cs :  » Charting-Reporting-Tools » googlechartsharp » GoogleChartSharp » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Charting Reporting Tools » googlechartsharp 
googlechartsharp » GoogleChartSharp » ShapeMarker.cs
using System;
using System.Collections.Generic;
using System.Text;

namespace GoogleChartSharp{
    public class ShapeMarker
    {
        ShapeMarkerType type;
        public ShapeMarkerType Type
        {
            get { return type; }
            set { type = value; }
        }

        string color;
        /// <summary>
        /// an RRGGBB format hexadecimal number.
        /// </summary>
        public string HexColor
        {
            get { return color; }
            set { color = value; }
        }

        int datasetIndex;
        /// <summary>
        /// the index of the line on which to draw the marker. This is 0 for the first data set, 1 for the second and so on
        /// </summary>
        public int DatasetIndex
        {
            get { return datasetIndex; }
            set { datasetIndex = value; }
        }

        float dataPoint;
        /// <summary>
        /// a floating point value that specifies on which data point the marker will be drawn. This is 1 for the first data set, 2 for the second and so on. Specify a fraction to interpolate a marker between two points
        /// </summary>
        public float DataPoint
        {
            get { return dataPoint; }
            set { dataPoint = value; }
        }

        int size;
        /// <summary>
        /// the size of the marker in pixels
        /// </summary>
        public int Size
        {
            get { return size; }
            set { size = value; }
        }

        /// <summary>
        /// Create a shape marker for points on line charts and scatter plots
        /// </summary>
        /// <param name="markerType"></param>
        /// <param name="hexColor">RRGGBB format hexadecimal number</param>
        /// <param name="datasetIndex">the index of the line on which to draw the marker. This is 0 for the first data set, 1 for the second and so on</param>
        /// <param name="dataPoint">a floating point value that specifies on which data point the marker will be drawn. This is 1 for the first data set, 2 for the second and so on. Specify a fraction to interpolate a marker between two points.</param>
        /// <param name="size">the size of the marker in pixels</param>
        public ShapeMarker(ShapeMarkerType markerType, string color, int datasetIndex, float dataPoint, int size)
        {
            this.type = markerType;
            this.color = color;
            this.datasetIndex = datasetIndex;
            this.dataPoint = dataPoint;
            this.size = size;
        }

        internal string GetTypeUrlChar()
        {
            switch (this.type)
            {
                case ShapeMarkerType.Arrow:
                    return "a";
                case ShapeMarkerType.Cross:
                    return "c";
                case ShapeMarkerType.Diamond:
                    return "d";
                case ShapeMarkerType.Circle:
                    return "o";
                case ShapeMarkerType.Square:
                    return "s";
                case ShapeMarkerType.VerticalLineToDataPoint:
                    return "v";
                case ShapeMarkerType.VerticalLine:
                    return "V";
                case ShapeMarkerType.HorizontalLine:
                    return "h";
                case ShapeMarkerType.XShape:
                    return "x";
            }
            return null;
        }

        internal string GetUrlString()
        {
            string s = string.Empty;
            s += GetTypeUrlChar() + ",";
            s += color + ",";
            s += datasetIndex + ",";
            s += dataPoint + ",";
            s += size.ToString();
            return s;
        }
    }

    public enum ShapeMarkerType
    {
        /// <summary>
        /// A marker in the shape of an arrow
        /// </summary>
        Arrow,

        /// <summary>
        /// A marker in the shape of a cross
        /// </summary>
        Cross,

        /// <summary>
        /// A marker in the shape of a diamond
        /// </summary>
        Diamond,

        /// <summary>
        /// A marker in the shape of a circle
        /// </summary>
        Circle,

        /// <summary>
        /// A marker in the shape of a square
        /// </summary>
        Square,

        /// <summary>
        /// A marker that is a vertical line from the x-axis to the data point
        /// </summary>
        VerticalLineToDataPoint,

        /// <summary>
        /// A marker that is a vertical line from the x-axis to the top of the chart area
        /// through the data point
        /// </summary>
        VerticalLine,

        /// <summary>
        /// A marker that is a horizontal line from the y-axis to the edge of the chart area 
        /// through the data point
        /// </summary>
        HorizontalLine,

        /// <summary>
        /// A marker in the shape of an X
        /// </summary>
        XShape
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.