1 | using System;
|
---|
2 | using System.Collections;
|
---|
3 | using System.Collections.Generic;
|
---|
4 | using System.ComponentModel;
|
---|
5 | using System.Text;
|
---|
6 | using JsonFx.Json;
|
---|
7 |
|
---|
8 | namespace OpenFlashChart
|
---|
9 | {
|
---|
10 | public abstract class ChartBase
|
---|
11 | {
|
---|
12 | private string type;
|
---|
13 | protected IList values;
|
---|
14 | private double fillalpha;
|
---|
15 | private double? alpha;
|
---|
16 | private double? fontsize;
|
---|
17 | private string colour;
|
---|
18 | private string text;
|
---|
19 | private string tooltip;
|
---|
20 | private DotStyle dotstyle;
|
---|
21 | private bool attachtorightaxis;
|
---|
22 | protected ChartBase()
|
---|
23 | {
|
---|
24 | this.values = new ArrayList();
|
---|
25 | FillAlpha = 0.35;
|
---|
26 | colour = "#CC3399";
|
---|
27 | attachtorightaxis = false;
|
---|
28 | }
|
---|
29 | public void AttachToRightAxis(bool attach)
|
---|
30 | {
|
---|
31 | attachtorightaxis = attach;
|
---|
32 | }
|
---|
33 | [JsonProperty("axis")]
|
---|
34 | [Description("use AttachToRight(),this property only for json generate.")]
|
---|
35 | public string AttachedAxis
|
---|
36 | {
|
---|
37 | get
|
---|
38 | {
|
---|
39 | if (attachtorightaxis)
|
---|
40 | return "right";
|
---|
41 | return null;
|
---|
42 | }
|
---|
43 | set
|
---|
44 | {
|
---|
45 | attachtorightaxis = string.Compare(value,"right",StringComparison.CurrentCultureIgnoreCase)==0;
|
---|
46 | }
|
---|
47 | }
|
---|
48 | [JsonProperty("colour")]
|
---|
49 | public string Colour
|
---|
50 | {
|
---|
51 | set { this.colour = value; }
|
---|
52 | get { return this.colour; }
|
---|
53 | }
|
---|
54 | public virtual int GetValueCount()
|
---|
55 | {
|
---|
56 | return values.Count;
|
---|
57 | }
|
---|
58 | [JsonProperty("tip")]
|
---|
59 | public virtual string Tooltip
|
---|
60 | {
|
---|
61 | set { this.tooltip = value; }
|
---|
62 | get { return this.tooltip; }
|
---|
63 | }
|
---|
64 |
|
---|
65 | [JsonProperty("values")]
|
---|
66 | public virtual IList Values
|
---|
67 | {
|
---|
68 | set
|
---|
69 | {
|
---|
70 | // foreach (T t in value)
|
---|
71 | // {
|
---|
72 | // this.values.Add(t);
|
---|
73 | // }
|
---|
74 | this.values = value;
|
---|
75 | }
|
---|
76 | get { return this.values; }
|
---|
77 | }
|
---|
78 |
|
---|
79 | [JsonProperty("font-size")]
|
---|
80 | [System.ComponentModel.DefaultValue(12.0)]
|
---|
81 | public double? FontSize
|
---|
82 | {
|
---|
83 | get { return fontsize; }
|
---|
84 | set { fontsize = value; }
|
---|
85 | }
|
---|
86 |
|
---|
87 | [JsonProperty("text")]
|
---|
88 | public string Text
|
---|
89 | {
|
---|
90 | get { return text; }
|
---|
91 | set { text = value; }
|
---|
92 | }
|
---|
93 |
|
---|
94 | [JsonProperty("fill-alpha")]
|
---|
95 | public double FillAlpha
|
---|
96 | {
|
---|
97 | get { return fillalpha; }
|
---|
98 | set { fillalpha = value; }
|
---|
99 | }
|
---|
100 | [JsonProperty("alpha")]
|
---|
101 | public double? Alpha
|
---|
102 | {
|
---|
103 | get { return alpha; }
|
---|
104 | set { alpha = value; }
|
---|
105 | }
|
---|
106 |
|
---|
107 | [JsonProperty("type")]
|
---|
108 | public string ChartType
|
---|
109 | {
|
---|
110 | get { return type; }
|
---|
111 | set { type = value; }
|
---|
112 | }
|
---|
113 | [JsonProperty("dot-style")]
|
---|
114 | public DotStyle DotStyleType
|
---|
115 | {
|
---|
116 | get
|
---|
117 | {
|
---|
118 | if(dotstyle==null)
|
---|
119 | dotstyle=new DotStyle();
|
---|
120 | return dotstyle;
|
---|
121 | }
|
---|
122 | set
|
---|
123 | {
|
---|
124 | if(dotstyle==null)
|
---|
125 | dotstyle=new DotStyle();
|
---|
126 | dotstyle = value;
|
---|
127 | }
|
---|
128 | }
|
---|
129 |
|
---|
130 | //public abstract Double GetMinValue();
|
---|
131 | //public abstract Double GetMaxValue();
|
---|
132 |
|
---|
133 | public void Set_Key(string key, double font_size)
|
---|
134 | {
|
---|
135 | this.Text = key;
|
---|
136 | FontSize = font_size;
|
---|
137 | }
|
---|
138 | public void Add(object v)
|
---|
139 | {
|
---|
140 | this.values.Add(v);
|
---|
141 | }
|
---|
142 | }
|
---|
143 | }
|
---|