Difference between revisions of "AxisOption class"

From Catglobe Wiki
Jump to: navigation, search
Line 35: Line 35:
  
 
=== <span style="color:#DF8621">'''Examples'''</span> ===
 
=== <span style="color:#DF8621">'''Examples'''</span> ===
 +
<span style="color:#DF8621"> New Axis option </span>
 
<source lang="javascript">
 
<source lang="javascript">
 
DataCacheSpecification dcs = new DataCacheSpecification(15636760);
 
DataCacheSpecification dcs = new DataCacheSpecification(15636760);
Line 44: Line 45:
 
axis.AddToAxisSet();
 
axis.AddToAxisSet();
 
dcs.Save();
 
dcs.Save();
 +
</source>
 +
<span style="color:#DF8621"> Update option </span>
 +
<source lang="javascript">
 +
DCS_use(15636575);
 +
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();
 
</source>
 
</source>

Revision as of 04:15, 24 July 2018

AxisOption



Represents an axis option in an axis.

Constructors

Methods

  • bool AddTag(string tag "Tag to work on") - Add a new tag, a tag cannot contain whitespace. Return false if already added
  • 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
  • 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.

Properties

  • Color Color { get; set; } - Get/set Color for this option
  • string Expression { get; set; } - Get/set Expression (nominator)
  • LocalizedString LocalizedNames { get; } - Get/set localized Name (title)
  • string Name { get; set; } - Get/set 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
  • TypeInformation TypeInformation { get; } - Get information about this class.


Examples

New Axis option

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

Update option

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