Difference between revisions of "Axis class"
Nguyenduyan (talk | contribs) |
Nguyenduyan (talk | contribs) |
||
Line 51: | Line 51: | ||
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Weight</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if used for weight</nowiki>}} | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Weight</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set if used for weight</nowiki>}} | ||
}} | }} | ||
+ | |||
+ | === <span style="color:#DF8621">'''Examples'''</span> === | ||
+ | <source lang="javascript"> | ||
+ | DataCacheSpecification dcs = new DataCacheSpecification(15636760); | ||
+ | Axis axis = new Axis (dcs, "Gender", "Your Gender"); | ||
+ | axis.MathBase = "Gender"; | ||
+ | axis.PctBase = "Gender!=empty"; | ||
+ | axis.AddOption(new AxisOption(dcs, "Male", "Gender == [1]")); | ||
+ | axis.AddOption(new AxisOption(dcs, "Female", "Gender == [2]")); | ||
+ | axis.AddToAxisSet(); | ||
+ | dcs.Save(); | ||
+ | </source> |
Revision as of 11:18, 23 July 2018
Axis
Represents an axis in a data cache specification.
Constructors
- (DataCacheSpecification dataCache "Validate against this data cache", string name "Initial name", string text "Initial text") - Create new axis
Methods
- int AddOption(AxisOption option "Option to add") - Add an option to current list
- Empty AddOrUpdateAxisInAxisSet() - Add or Update this axis in the axis set of the given data cache
- bool AddTag(string tag "Tag to work on") - Add a new tag. Return false if already added
- bool AddToAxisSet() - Add this axis to the axis set of the given data cache. Return false if Name already exists
- int CountOptions() - Number of current options
- object this[] { get; }(int index "Index") - Backward-compatible indexer
- bool HasTag(string tag "Tag to work on") - Return true if tag is added
- Array of string ListTags() - Return list of all added tags
- Empty RemoveOption(AxisOption option "Option to remove") - Remove option
- bool RemoveOption(int index "Index of option in the list") - Remove option
- bool RemoveTag(string tag "Tag to work on") - Remove a tag. Return false if not added
- Empty this[] { set; }(int index "Index", object value "Value to set") - Backward-compatible indexer
- string ToString() - The string representation of the object.
- bool UpdateAxisInAxisSet() - Update this axis in the axis set of the given data cache. Return false if Name does not exist already
Properties
- Color Color { get; set; } - Get/set Color for this axis
- LocalizedString LocalizedTexts { get; } - Get/set localized Text (description)
- LocalizedString LocalizedTitles { get; } - Get/set localized Titles
- string MathBase { get; set; } - Get/set Math base (dcs column used to calculate statitics on)
- string MathBaseModifier { get; set; } - Get/set Math base modifier (filter for statistics calculations)
- string Name { get; set; } - Get/set Name (unique id)
- string ObjectTypeName { get; } - The name of the type of object.
- array Options { get; set; } - Get/set options
- string PctBase { get; set; } - Get/set Percentage base (denominator) for all options
- string Text { get; set; } - Get/set Text (description)
- TypeInformation TypeInformation { get; } - Get information about this class.
- bool Weight { get; set; } - Get/set if used for weight
Examples
DataCacheSpecification dcs = new DataCacheSpecification(15636760);
Axis axis = new Axis (dcs, "Gender", "Your Gender");
axis.MathBase = "Gender";
axis.PctBase = "Gender!=empty";
axis.AddOption(new AxisOption(dcs, "Male", "Gender == [1]"));
axis.AddOption(new AxisOption(dcs, "Female", "Gender == [2]"));
axis.AddToAxisSet();
dcs.Save();