AxisOption class

From Catglobe Wiki
Jump to: navigation, search

AxisOption


Represents an axis option in an axis.

Parent class

Inherits from Array

Constructors

Methods

  • Empty AddAccessGroup(int groupResourceId "Group to give access") - Add a new group that has access to this option.
  • bool AddTag(string tag "Tag to work on") - Add a new tag, a tag cannot contain whitespace. Return false if already added
  • (From array) bool Any(Function predicate "A function that takes 1 parameter of the types in the array, and return true/false") - Return true if the array contains the element using the given function.
  • (From array) bool Contains(object element "Element to check for") - Return true if the array contains the element using the normal equal operator.
  • (From array) array Except(array elements "Elements to remove") - Return all elements that does not exist in the other collection.
  • (From array) object First(Function selector "A function to test each element for a condition.") - Returns the first element in a sequence that satisfies a specified condition.
  • (From array) object FirstOrDefault(Function selector "A function to test each element for a condition.") - Returns the first element in a sequence that satisfies a specified condition or empty if not found.
  • (From array) int Frequency(number number "The number to search for") - Counts the number of times a given Number object exists in the Array. Can only use if all the elements are of type Number
  • object this[] { get; }(int index "Index") - Backward-compatible indexer
  • bool HasAccessGroup(int groupResourceId "AccessGroup to work on") - Return true if group is added
  • bool HasTag(string tag "Tag to work on") - Return true if tag is added
  • (From array) int IndexOf(object element "Element to search for") - Return index of the given element, or -1.
  • (From array) bool IsCharacterArray() - check if array is an array of characters
  • (From array) bool IsNumericArray() - check if array is an array of integer numbers
  • (From array) bool IsStringArray() - check if array is an array of string
  • Array of int ListAccessGroups() - Return list of all added AccessGroups
  • Array of string ListTags() - Return list of all added tags
  • (From array) array OrderBy(Function comparer "Function that compares two objects of the same type. Must return a signed integer that indicates the relative values of first param A and second param B. Value Less than 0 : A is less than B.Value 0 : A equals B.Value Greater than 0 : A is greater than B.It can also be a function that takes 1 parameter and returns a string or number.") - Sorts the elements of a sequence in ascending order by using a specified comparer.
  • (From array) Empty Randomize() - Randomize the order of the elements in the current array.
  • Empty RemoveAccessGroup(int groupResourceId "AccessGroup to work on") - Remove a group.
  • bool RemoveTag(string tag "Tag to work on") - Remove a tag. Return false if not added
  • (From array) array Reverse() - Returns an array with all the elements in the opposite order.
  • (From array) array Select(Function selector "A transform function to apply to each element.") - Projects each element of a sequence into a new form.
  • (From array) array SelectMany(Function selector "A transform function to get each sub array.") - Projects each array element of a sequence into a new form.
  • Empty this[] { set; }(int index "Index", object value "Value to set") - Backward-compatible indexer
  • (From array) array Skip(int n "How many elements to skip") - Get all but the n first elements.
  • (From array) array Take(int n "How many elements to take") - Get the n first elements.
  • (From array) Dictionary ToDictionary(Function keySelector "A transform function to get the key of each element.") - Return a dictionary with the elements of the array.
  • (From array) Dictionary ToDictionary(Function keySelector "A transform function to get the key of each element.", Function valueSelector "A transform function to get the value of each element.") - Return a dictionary with the elements of the array.
  • (From Array) string ToString() - The string representation of the object.
  • (From array) array Where(Function predicate "A function that takes 1 parameter of the types in the array, and an optional 2nd parameter that is the index and return true/false") - Filters a sequence of values based on a predicate.

Properties

  • (From array) number Average { get; } - Average of the objects in the Array object. Can only use if all the elements are of type Number
  • Color Color { get; set; } - Get/set Color for this option
  • string Expression { get; set; } - Get/set Expression (nominator)
  • bool HasAccess { get; } - Get if current logged in user has access (Voluntary access control, doesn't check inheritance, if no groups defined this returns true)
  • LocalizedString LocalizedNames { get; } - Get/set localized Name (title)
  • (From array) number Max { get; } - Largest of all the objects in the Array object. Can only use if all the elements are of type Number
  • (From array) number Min { get; } - Smallest of all the objects in the Array object. Can only use if all the elements are of type Number
  • string Name { get; set; } - Get/set default language name (title)
  • string ObjectTypeName { get; } - The name of the type of object.
  • string PctBase { get; set; } - Get/set Percentage base (denominator). If empty then inherit from Axis
  • (From array) number Sum { get; } - Sum of all the objects in the Array object. Can only use if all the elements are of type Number
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.
  • string Value { get; set; } - Get/set Value (input value to axis base expression)


Examples

New Axis option use Option Expression

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();

New Axis option use Option value as string

DataCacheSpecification dcs = new DataCacheSpecification(15639270);
Axis axis = new Axis (dcs, "Gender", "Your Gender");
axis.MathBase = "Gender";
axis.BaseExpression = "Gender == %VALUE%";
axis.PctBase = "Gender!=empty";
axis.AddOption(new AxisOption(dcs, "Male", "", "1"));
axis.AddOption(new AxisOption(dcs, "Female", "", "2"));
axis.AddToAxisSet();
dcs.Save();

New Axis option use Option value as Range

DataCacheSpecification dcs = new DataCacheSpecification(15639273);
Axis axis = new Axis (dcs, "AgeGroup", "Your Age");
axis.MathBase = "Age";
axis.BaseExpression = "Age == %VALUE%";
axis.PctBase = "Age!=empty";
axis.AddOption(new AxisOption(dcs, "Young", "", new Range ("[1,2-3]")));
axis.AddOption(new AxisOption(dcs, "Old", "", new Range ("[4]")));
axis.AddToAxisSet();
dcs.Save();

Update option

DCS_use(15636760);
Axis axis = AxisSet_getAxis("Gender");
array options = axis.Options;
for(number i=0; i<options.Count; i++)
{
	AxisOption option = options[i];
	option.PctBase = "Gender != empty";
}
AxisSet_save();