DataWeb
Search Results for

    Show / Hide Table of Contents

    Class WidgetGoalTrends

    Represents the WidgetGoalTrends class which extends the DashboardWidget class.

    Inheritance
    object
    DashboardWidget
    WidgetTrends
    WidgetGoalTrends
    Inherited Members
    WidgetTrends.GetDefaultSettingsAsync(DashboardPanel, IUser, CancellationToken)
    WidgetTrends.GetOptionsAsync(DashboardPanel, Dictionary<string, object>, IUser, CancellationToken)
    WidgetTrends.ValidateSettingsAsync(DashboardPanel, Dictionary<string, object>, Dictionary<string, object>, IUser, CancellationToken)
    WidgetTrends.UpdateSettingsAsync(DashboardPanel, Dictionary<string, object>, Dictionary<string, object>, IUser, CancellationToken)
    WidgetTrends.GetPeriodModes()
    WidgetTrends.GetPeriodData(string, DateTime?, DateTime?)
    DashboardWidget.serviceProvider
    DashboardWidget.IdMaster
    DashboardWidget.Name
    DashboardWidget.Title
    DashboardWidget.Type
    DashboardWidget.Settings
    DashboardWidget.WidgetComponent
    DashboardWidget.WidgetClass
    DashboardWidget.VisibleRoles
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DataWeb.Dashboard.Widgets
    Assembly: DataWeb.Core.dll
    Syntax
    public class WidgetGoalTrends : WidgetTrends

    Constructors

    WidgetGoalTrends(IServiceProvider)

    Represents the WidgetGoalTrends class which extends the DashboardWidget class.

    Declaration
    public WidgetGoalTrends(IServiceProvider serviceProvider)
    Parameters
    Type Name Description
    IServiceProvider serviceProvider

    Methods

    GetDataAsync(DashboardPanel, Dictionary<string, object>, IUser, CancellationToken)

    Gets the data for the widget with goal trends and period aggregation.

    Declaration
    public override Task<DashboardWidgetContentData> GetDataAsync(DashboardPanel panel, Dictionary<string, object> widgetSettings, IUser user, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    DashboardPanel panel

    The DashboardPanel that the widget belongs to.

    Dictionary<string, object> widgetSettings

    The widget settings containing PeriodMode and optional custom date range.

    IUser user

    The IUser who is viewing the widget.

    CancellationToken cancellationToken

    The CancellationToken to cancel the operation.

    Returns
    Type Description
    Task<DashboardWidgetContentData>

    The widget data with goal trends and chart data; base data if cast fails.

    Overrides
    WidgetTrends.GetDataAsync(DashboardPanel, Dictionary<string, object>, IUser, CancellationToken)
    Remarks

    Guard: Validates PeriodMode setting before processing. Custom mode requires PeriodDateStart and PeriodDateEnd; uses DateTime.TryParse for safe conversion. Uses safe cast pattern (is not) to handle invalid type conversions gracefully.

    GetGoalData(PeriodData, string, string, string, string, string, CancellationToken)

    Asynchronously retrieves goal data for a given period with aggregation.

    Declaration
    public virtual Task<WidgetGoalTrends.GoalData> GetGoalData(PeriodData periodData, string chartType = "Bar", string goalName = null, string goalCategory = null, string goalReferenceId = null, string goalColor = "Blue", CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    PeriodData periodData

    The period data with aggregation mode (Hour, Day, Month, Year) and date range.

    string chartType

    The type of chart to display (e.g., "Bar"). Defaults to "Bar".

    string goalName

    The name of the goal to retrieve data for; optional.

    string goalCategory

    The category of the goal to retrieve data for; optional.

    string goalReferenceId

    The reference ID of the goal to retrieve data for; optional.

    string goalColor

    The color of the goal data in the chart. Defaults to "Blue".

    CancellationToken cancellationToken

    The CancellationToken to cancel the operation.

    Returns
    Type Description
    Task<WidgetGoalTrends.GoalData>

    The goal data with chart and total data; never null.

    Remarks

    Aggregation modes:

    • Hour: Groups goals by hour (0-23); includes pre-grouped lookup via GroupBy().ToDictionary() for performance.
    • Day: Groups goals by date; uses .Date comparison for accurate day-level aggregation.
    • Month: Aggregates goals per month using GetGoalTotalValueAsync() for month boundaries.
    • Year: Aggregates goals per year using GetGoalTotalValueAsync() for year boundaries. Uses localization constants for all UI strings (Period, Total labels).

    Extension Methods

    DashboardMapperExtension.ToDashboardWidgetInfo(DashboardWidget)
    In this article
    Back to top Generated by DocFX