Library panel

The library contains reusable assets such as dimensions, measures and master objects that you can use throughout your app. You create and use these assets to apply global changes to your dimensions, measures and master objects. This section describes how to list, create and remove these assets in the library.

Master objects

A master object is created from an existing chart, for example a Pie chart, and are reusable visualizations that you can use throughout your app. For more information on creating charts see Create a pie chart. You create and use master objects to apply global changes to your visualizations. Listing, adding and removing master objects is done using the IApp interface.

Example: Show a MasterObject list

IMasterObjectList masterList = App.GetMasterObjectList();

Example: Create a MasterObject list

This method creates a master object from a source object, SalesPieChartID.

Create master object, this method will create a master object from source object ("SalesPieChartID").

var prop = new MasterObjectProperties()
	{
		MetaDef = new MetaAttributesDef
		{
			Title = "Sales chart",
			Description = "This chart show the total sales per region"
		}
	};
	App.CreateMasterObject("SalesPieChartID", "SalesMasterObjectID", prop);

Example: Linking a object to a master object

This method will convert the source object MyOldPiechartID to a linked object (linked to the master object id).

App.LinkMasterObject("MyOldPiechartID", "SalesMasterObjectID");

Example: Create and link

This method will create a master object and will convert the source object SalesPieChartID into a linked object (linked to the newly created master object).

var prop = new MasterObjectProperties()
	{
		MetaDef = new MetaAttributesDef
		{
			Title = "Sales chart",
			Description = "This chart show the total sales per region"
		}
	};
	App.CreateAndLinkMasterObject("SalesPieChartID", "SalesMasterObjectID", prop);

Example: Unlink a MasterObject list

This method will convert the source object to the type of the master object.

App.UnlinkMasterObject("MyLinkedSalesMasterObjectID");

Example: Remove a MasterObject list

App.RemoveMasterObject(myMasterObject.Id);

Dimensions

A dimension is an object defined at app level. Listing, adding and removing a dimension is done using the IApp interface.

Example: Add a dimension list

IDimensionList dimList = App.GetDimensionList();

Example: Create a dimension list

IDimension myDimension = App.CreateDimension(dim,
	new DimensionProperties
	{
		MetaDef = new MetaAttributesDef{
			Title = "Dimension " + dim,
			Description = "My " + dim
		},
		Dim = new NxLibraryDimensionDef
		{
			FieldDefs = new[] { dim },
			FieldLabels = new[] { dim },
		}
	});	

Example: Remove a dimension list

App.RemoveDimension(myDimension.Id);

Measure

Measures are calculations used in visualizations. Listing, adding and removing a measure is done using the IApp interface.

Example: Add a measure list

IMasterObjectList measureList = App.GetMeasureList();

Example: Create a measure list

IMeasure myMeasure = App.CreateMeasure(meas,
	new MeasureProperties
	{
		Measure = new NxLibraryMeasureDef
		{
			Def = meas,
			Label = meas
		},
		MetaDef = new MetaAttributesDef
		{
			Title = meas,
			Description = meas.Replace("(", " ").Replace(")", "")
		}
	});	

Example: Remove a measure list

App.RemoveMeasure(myMeasure.Id);

Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?