Plots#
The Plots module is a component that enables you to create charts and graphs based on data from your application. With this module, you can create a variety of chart types including line, bar, and pie charts. Additionally, you can customize the appearance of the charts, including colours, font sizes, and axis labels. The Plot module supports data from a variety of sources, including local data sources and remote data sources such as APIs or databases. Finally, the Plot module includes advanced features such as data aggregation and filtering, allowing you to create complex charts and visualizations based on your data.
Under the hood, the Plots module leverages the Plotly JavaScript Open Source Graphing Library.
PlotView#
A PlotView is the CtrlPortals SegmentComponent
that allows you to create plots, charts, and graphs based on data retrieved from the M-Files vault. It allows you to visualize data in various chart types such as line, bar, and pie charts.
The configuration options for the PlotView are:
Height
: an integer representing the height of the plot in pixels.Mode
: an optional string that determines the mode of the PlotView.QueryConfiguration
: a QueryConfiguration object that determines how data is queried from the M-Files vault.Title
: an optional string that represents the title of the plot.Type
: a string that represents the type of the plot.
QueryConfiguration#
The QueryConfiguration is a configuration object that specifies how to query data from the M-Files vault in the context of a PlotView. It defines the data source for the plot by specifying which objects to retrieve, which properties to include, and how to group and aggregate data.
The QueryConfiguration contains a list of Series objects, each of which represents a set of data that can be plotted on the same chart. Each Series object specifies which objects to retrieve, which properties to include, and how to group and aggregate data for that series. The QueryConfiguration also includes a list of SelectedProperty objects, which represent individual properties that are selected for retrieval in one or more Series objects.
When a PlotView is rendered, it uses the QueryConfiguration to query data from the M-Files vault and generates a chart based on the results. By modifying the QueryConfiguration, you can control what data is included in the chart and how it is visualized.
The QueryConfiguration object has the following configuration options:
Series
: a list of Series objects that represents the data series in the plot.SelectedProperty
: a SelectedProperty object that represents a property of the queried objects that will be displayed in the plot.SortDirection
: a SortDirection object that determines the sorting direction of the queried data.
SelectedProperty#
When constructing a query, you will typically want to retrieve certain properties from the objects being queried. For example, if you were querying invoices, you might want to retrieve the invoice number, the customer name, and the date of the invoice.
SelectedProperty allows you to specify which properties you want to retrieve. The class has two properties:
Column
: This is the name of the column in the database where the property is stored.Property
: This is an MFIdentifier object that identifies the property itself. An MFIdentifier object consists of an object type and a property ID.
Series#
A Series refers to a set of data that will be plotted on a graph using the PlotView component. Each Series object contains information about how to retrieve and group data from the M-Files vault, such as the object type, document class, and selected properties. These properties are used to construct a table of data that will be plotted on the graph, with each row of the table representing a point on the graph. The Series objects are then passed to the QueryConfiguration
property of the PlotView component, which is responsible for retrieving the data and grouping it into the format needed for the graph.
The Series object has the following configuration options:
Aggregation
: an optional string that represents the aggregation function to be applied to the data.DirectRelation
: an optional MFIdentifier object that represents the metadata of the direct relation.GroupColumns
: an optional string that represents the name of the columns to group the data by.IndirectRelation
: an optional MFIdentifier object that represents the metadata of the indirect relation.LabelColumn
: a string that represents the name of the column to be used as the label axis in the plot.Name
: a string that represents the name of the series.ObjClass
: an optional MFIdentifier object that represents the metadata of the object class.ObjType
: a MFIdentifier object that represents the metadata of the object type.RoundDateTimeColumns
: an optional string that represents the name of the columns to round the date and time values.RoundDateTimeUnit
: an optional string that represents the unit of the rounded date and time values.SelectedPropertyValues
: a list of SelectedProperty objects that represent the selected properties.SortColumn
: an optional string that represents the name of the column to sort the data by.SortDirection
: a SortDirection object that represents the sorting direction.SplitColumns
: an optional string that represents the name of the columns to split the data by.ValueColumn
: a string that represents the name of the column to be used as the value axis in the plot.Where
: an optional SearchConditionsJA object that represents the search conditions for the query.