Class ChartBuilder

Object
ChartBuilder

public final class ChartBuilder extends Object
  • Constructor Details

    • ChartBuilder

      public ChartBuilder()
    • ChartBuilder

      public ChartBuilder(IdGenerator idGenerator, InvocationBuilder<MethodInvocation> invocationBuilder)
  • Method Details

    • newScatter

      public ScatterChart newScatter()
      Creates a new ScatterChart builder, the starting point for defining a Scatter Chart, one of the chart types available in the Data Analyzer within Analytics. Unlike chart types that plot a measure against a category or a time axis, a Scatter Chart plots two independent numeric measures against each other (X and Y), which makes it well suited to visualizing the correlation between two measures, for example order quantity versus invoice price.

      Add data to the chart with ScatterChart.addSeries(), then finish the definition with ScatterChart.build(). The resulting chart definition is what Dashboard portlets, quote headers, and other Data Analyzer areas render. The same Groovy code is also what the View Expression function generates when a user builds the equivalent chart in the Pricefx UI.

      This method behaves the same way regardless of execution mode (input generation, syntax check, or distributed calculation). Calling it does not modify any Pricefx data; it only returns a new, independent chart definition builder to continue the fluent chain.

      Example:

      
       api.newChartBuilder().newScatter()
               .addSeries()
                   .setLabel("Revenue vs Quantity")
                   .setDatamart("datamart_transaction")
                   .setCurrency("USD")
                   .setAxisX("Quantity")
                       .back()
                   .setAxisY("InvoicePrice")
                       .back()
                   .back()
               .build()
       
      Returns:
      a new ScatterChart instance. Never null.
      See Also:
    • newTimeSeriesScatter

      public TimeSeriesScatterChart newTimeSeriesScatter()
      Creates a new TimeSeriesScatterChart builder, the starting point for defining a Time Series Scatter Chart, one of the chart types available in the Data Analyzer within Analytics. Like a ScatterChart, it plots two independent aggregated numeric measures against each other (X and Y). Unlike a Scatter Chart, its X axis is rendered as a date/time axis rather than a plain numeric one, which makes it well suited to visualizing how the relationship between two measures evolves over time, without pre-bucketing the data into fixed periods the way newTimeSeries() does.

      Add data to the chart with TimeSeriesScatterChart.addSeries(), then finish the definition with TimeSeriesScatterChart.build(). The resulting chart definition is what Dashboard portlets, quote headers, and other Data Analyzer areas render. The same Groovy code is also what the View Expression function generates when a user builds the equivalent chart in the Pricefx UI.

      This method behaves the same way regardless of execution mode (input generation, syntax check, or distributed calculation). Calling it does not modify any Pricefx data; it only returns a new, independent chart definition builder to continue the fluent chain.

      Example:

      
       api.newChartBuilder().newTimeSeriesScatter()
               .addSeries()
                   .setLabel("Order Date vs Margin")
                   .setDatamart("datamart_transaction")
                   .setCurrency("USD")
                   .setAxisX("InvoiceDate")
                       .back()
                   .setAxisY("MarginPercent")
                       .back()
                   .back()
               .build()
       
      Returns:
      a new TimeSeriesScatterChart instance. Never null.
      See Also:
    • newBarLine

      public BarLineChart newBarLine()
      Creates a new BarLineChart builder, the starting point for defining a Bar & Line Chart, one of the chart types available in the Data Analyzer within Analytics. Its X axis is a plain category field and its Y axis is one or more aggregated numeric measures, which makes it well suited to comparing a measure across categories, such as revenue by country. Each series can optionally be rendered as a boxplot overlay, sorted along either axis, or compared against a prior period (see BarLineChart for those series- and options-level methods).

      Add data to the chart with BarLineChart.addSeries(), then finish the definition with BarLineChart.build(). The resulting chart definition is what Dashboard portlets, quote headers, and other Data Analyzer areas render. The same Groovy code is also what the View Expression function generates when a user builds the equivalent chart in the Pricefx UI.

      This method behaves the same way regardless of execution mode (input generation, syntax check, or distributed calculation). Calling it does not modify any Pricefx data; it only returns a new, independent chart definition builder to continue the fluent chain.

      Example:

      
       api.newChartBuilder().newBarLine()
               .addSeries()
                   .setLabel("Revenue by Country")
                   .setDatamart("datamart_transaction")
                   .setCurrency("USD")
                   .setAxisX("Country")
                   .setAxisY("InvoicePrice")
                       .withTotal()
                       .back()
                   .back()
               .build()
       
      Returns:
      a new BarLineChart instance. Never null.
      See Also:
    • newBubble

      public BubbleChart newBubble()
      Creates a new BubbleChart builder, the starting point for defining a Bubble Chart, one of the chart types available in the Data Analyzer within Analytics. Like a ScatterChart, it plots two independent aggregated numeric measures against each other (X and Y). Unlike a Scatter Chart, each data point additionally encodes a third aggregated measure as the size of its bubble marker, set via BubbleChart.BubbleSeries.setBubbleSize(String), which makes it well suited to comparing three measures at once, for example correlating quantity and price while sizing bubbles by margin.

      Add data to the chart with BubbleChart.addSeries(), then finish the definition with BubbleChart.build(). The resulting chart definition is what Dashboard portlets, quote headers, and other Data Analyzer areas render. The same Groovy code is also what the View Expression function generates when a user builds the equivalent chart in the Pricefx UI.

      This method behaves the same way regardless of execution mode (input generation, syntax check, or distributed calculation). Calling it does not modify any Pricefx data; it only returns a new, independent chart definition builder to continue the fluent chain.

      Example:

      
       api.newChartBuilder().newBubble()
               .addSeries()
                   .setLabel("Quantity vs Price by Margin")
                   .setDatamart("datamart_transaction")
                   .setCurrency("USD")
                   .setAxisX("Quantity")
                       .back()
                   .setAxisY("InvoicePrice")
                       .back()
                   .setBubbleSize("MarginPercent")
                       .back()
                   .back()
               .build()
       
      Returns:
      a new BubbleChart instance. Never null.
      See Also:
    • newPie

      public PieChart newPie()
      Creates a new PieChart builder, the starting point for defining a Pie Chart, one of the chart types available in the Data Analyzer within Analytics. Unlike axis-based chart types, a Pie Chart has no X or Y axis. Each series instead slices an aggregated numeric measure by category: the category field is set with PieChart.PieSeries.setCategories(String) and the measure that determines each slice's size is set with PieChart.PieSeries.setSize(String), which makes it well suited to visualizing a measure's share across a small number of categories, such as revenue by region.

      Add data to the chart with PieChart.addSeries(), then finish the definition with PieChart.build(). The resulting chart definition is what Dashboard portlets, quote headers, and other Data Analyzer areas render. The same Groovy code is also what the View Expression function generates when a user builds the equivalent chart in the Pricefx UI.

      This method behaves the same way regardless of execution mode (input generation, syntax check, or distributed calculation). Calling it does not modify any Pricefx data; it only returns a new, independent chart definition builder to continue the fluent chain.

      Example:

      
       api.newChartBuilder().newPie()
               .addSeries()
                   .setLabel("Revenue by Region")
                   .setDatamart("datamart_transaction")
                   .setCurrency("USD")
                   .setCategories("Region")
                   .setSize("InvoicePrice")
                       .back()
                   .back()
               .build()
       
      Returns:
      a new PieChart instance. Never null.
      See Also:
    • newWaterfall

      public WaterfallChart newWaterfall()
      Creates a new WaterfallChart builder, the starting point for defining a Waterfall Chart, one of the chart types available in the Data Analyzer within Analytics. Unlike other chart types, a Waterfall Chart has exactly one series, obtained with WaterfallChart.getSeries() rather than an addSeries() method. That series is composed of explicitly added named columns rather than a single aggregated measure: each column is added with WaterfallChart.WaterfallSeries.addWaterfallColumn(WaterfallColumnType, String, String) as either an ADD or SUBTRACT step (an increase or decrease sourced from a field) or a RESULT step (a running total), which makes it well suited to visualizing how a starting value is built up or drawn down to a final total, for example bridging beginning and ending inventory through receipts and shipments. To compare two such bridges side by side, see newWaterfallComparison() instead.

      Finish the definition with WaterfallChart.build(). The resulting chart definition is what Dashboard portlets, quote headers, and other Data Analyzer areas render. The same Groovy code is also what the View Expression function generates when a user builds the equivalent chart in the Pricefx UI.

      This method behaves the same way regardless of execution mode (input generation, syntax check, or distributed calculation). Calling it does not modify any Pricefx data; it only returns a new, independent chart definition builder to continue the fluent chain.

      Example:

      
       api.newChartBuilder().newWaterfall()
               .getSeries()
                   .setLabel("Inventory Bridge")
                   .setDatamart("datamart_transaction")
                   .setCurrency("USD")
                   .addWaterfallColumn(WaterfallColumnType.ADD, "Receipts", null)
                   .addWaterfallColumn(WaterfallColumnType.SUBTRACT, "Shipments", null)
                   .addWaterfallColumn(WaterfallColumnType.RESULT, null, "Ending Inventory")
                   .back()
               .build()
       
      Returns:
      a new WaterfallChart instance. Never null.
      See Also:
    • newWaterfallComparison

      public WaterfallComparisonChart newWaterfallComparison()
      Creates a new WaterfallComparisonChart builder, the starting point for defining a Waterfall Comparison Chart, one of the chart types available in the Data Analyzer within Analytics. Each series is built the same way as with newWaterfall(): from named columns added with WaterfallComparisonChart.WaterfallComparisonSeries.addWaterfallColumn(WaterfallColumnType, String, String) as either an ADD or SUBTRACT step or a RESULT running total. Unlike a plain Waterfall Chart, which has exactly one series, a Waterfall Comparison Chart supports multiple series added with WaterfallComparisonChart.addSeries(), which makes it well suited to comparing two or more such bridges side by side, for example this year's inventory bridge against last year's.

      Finish the definition with WaterfallComparisonChart.build(). The resulting chart definition is what Dashboard portlets, quote headers, and other Data Analyzer areas render. The same Groovy code is also what the View Expression function generates when a user builds the equivalent chart in the Pricefx UI.

      This method behaves the same way regardless of execution mode (input generation, syntax check, or distributed calculation). Calling it does not modify any Pricefx data; it only returns a new, independent chart definition builder to continue the fluent chain.

      Example:

      
       api.newChartBuilder().newWaterfallComparison()
               .addSeries()
                   .setLabel("This Year")
                   .setDatamart("datamart_transaction")
                   .setCurrency("USD")
                   .addWaterfallColumn(WaterfallColumnType.ADD, "Receipts", null)
                   .addWaterfallColumn(WaterfallColumnType.RESULT, null, "Ending Inventory")
                   .back()
               .addSeries()
                   .setLabel("Last Year")
                   .setDatamart("datamart_transaction")
                   .setCurrency("USD")
                   .addWaterfallColumn(WaterfallColumnType.ADD, "ReceiptsPriorYear", null)
                   .addWaterfallColumn(WaterfallColumnType.RESULT, null, "Ending Inventory")
                   .back()
               .build()
       
      Returns:
      a new WaterfallComparisonChart instance. Never null.
      See Also:
    • newTimeSeries

      public TimeSeriesChart newTimeSeries()
      Creates a new TimeSeriesChart builder, the starting point for defining a Time Series Chart, one of the chart types available in the Data Analyzer within Analytics. A Time Series Chart plots one or more aggregated numeric measures (the Y axis) against a date/time field (the X axis), which makes it well suited to visualizing a trend, such as revenue over time.

      Add data to the chart with TimeSeriesChart.addSeries(), then finish the definition with TimeSeriesChart.build(). The resulting chart definition is what Dashboard portlets, quote headers, and other Data Analyzer areas render. The same Groovy code is also what the View Expression function generates when a user builds the equivalent chart in the Pricefx UI.

      This method behaves the same way regardless of execution mode (input generation, syntax check, or distributed calculation). Calling it does not modify any Pricefx data; it only returns a new, independent chart definition builder to continue the fluent chain.

      Example:

      
       api.newChartBuilder().newTimeSeries()
               .addSeries()
                   .setLabel("Revenue over Time")
                   .setDatamart("datamart_transaction")
                   .setCurrency("USD")
                   .setAxisX("InvoiceDate")
                   .setAxisY("InvoicePrice")
                       .back()
                   .back()
               .build()
       
      Returns:
      a new TimeSeriesChart instance. Never null.
      See Also:
    • newDetailedTimeSeries

      public DetailedTimeSeriesChart newDetailedTimeSeries()
      Creates a new DetailedTimeSeriesChart builder, the starting point for defining a Detailed Time Series Chart, one of the chart types available in the Data Analyzer within Analytics. Like newTimeSeries(), its X axis is a date/time field and its Y axis is an aggregated numeric measure, but a Detailed Time Series Chart plots data points along a continuous date/time axis instead of one point per periodic bucket, and its options additionally support bounding that axis to an explicit date range with DetailedTimeSeriesChart.DetailedTimeSeriesOptions.setXMin(java.util.Date) and DetailedTimeSeriesChart.DetailedTimeSeriesOptions.setXMax(java.util.Date). Each series can also pick its own rendering type, which makes it well suited to overlaying, for example, a line series and a column series on the same continuous timeline.

      Add data to the chart with DetailedTimeSeriesChart.addSeries(), then finish the definition with DetailedTimeSeriesChart.build(). The resulting chart definition is what Dashboard portlets, quote headers, and other Data Analyzer areas render. The same Groovy code is also what the View Expression function generates when a user builds the equivalent chart in the Pricefx UI.

      This method behaves the same way regardless of execution mode (input generation, syntax check, or distributed calculation). Calling it does not modify any Pricefx data; it only returns a new, independent chart definition builder to continue the fluent chain.

      Example:

      
       api.newChartBuilder().newDetailedTimeSeries()
               .addSeries()
                   .setLabel("Revenue over Time")
                   .setDatamart("datamart_transaction")
                   .setCurrency("USD")
                   .setAxisX("InvoiceDate")
                   .setAxisY("InvoicePrice")
                       .back()
                   .back()
               .build()
       
      Returns:
      a new DetailedTimeSeriesChart instance. Never null.
      See Also:
    • newHistogram

      public HistogramChart newHistogram()
      Creates a new HistogramChart builder, the starting point for defining a Histogram, one of the chart types available in the Data Analyzer within Analytics. Unlike other chart types, a Histogram has exactly one series, obtained with HistogramChart.getSeries() rather than an addSeries() method. The X axis is the aggregated numeric measure whose distribution is being visualized, set with HistogramChart.HistogramSeries.setAxisX(String), and HistogramChart.HistogramSeries.setBins(java.math.BigDecimal) controls the approximate number of bins that measure is grouped into, which makes it well suited to visualizing how a measure is distributed across a population, for example how deal sizes are spread across a range of values.

      Finish the definition with HistogramChart.build(). The resulting chart definition is what Dashboard portlets, quote headers, and other Data Analyzer areas render. The same Groovy code is also what the View Expression function generates when a user builds the equivalent chart in the Pricefx UI.

      This method behaves the same way regardless of execution mode (input generation, syntax check, or distributed calculation). Calling it does not modify any Pricefx data; it only returns a new, independent chart definition builder to continue the fluent chain.

      Example:

      
       api.newChartBuilder().newHistogram()
               .getSeries()
                   .setLabel("Deal Size Distribution")
                   .setDatamart("datamart_transaction")
                   .setCurrency("USD")
                   .setAxisX("InvoicePrice")
                       .back()
                   .setBins(20)
                   .setAxisY("Count")
                   .back()
               .build()
       
      Returns:
      a new HistogramChart instance. Never null.
      See Also:
    • newBoxplot

      public BoxplotChart newBoxplot()
      Creates a new BoxplotChart builder, the starting point for defining a Box Plot Chart, one of the chart types available in the Data Analyzer within Analytics. Its X axis is a plain category field, set with BoxplotChart.BoxplotSeries.setAxisX(String), and its Y axis is a Box Plot expression field, set with BoxplotChart.BoxplotSeries.setAxisY(String), which supplies the statistical distribution (minimum, quartiles, maximum) plotted for each category rather than a single aggregated value. The whisker calculation is configurable per series with BoxplotChart.BoxplotSeries.withWhisker(WhiskerType), which makes it well suited to visualizing how a measure's distribution, not just its average, varies across categories, for example price spread by product group.

      Add data to the chart with BoxplotChart.addSeries(), then finish the definition with BoxplotChart.build(). The resulting chart definition is what Dashboard portlets, quote headers, and other Data Analyzer areas render. The same Groovy code is also what the View Expression function generates when a user builds the equivalent chart in the Pricefx UI.

      This method behaves the same way regardless of execution mode (input generation, syntax check, or distributed calculation). Calling it does not modify any Pricefx data; it only returns a new, independent chart definition builder to continue the fluent chain.

      Example:

      
       api.newChartBuilder().newBoxplot()
               .addSeries()
                   .setLabel("Price Spread by Product Group")
                   .setDatamart("datamart_transaction")
                   .setCurrency("USD")
                   .setAxisX("ProductGroup")
                   .setAxisY("InvoicePriceBoxplot")
                       .back()
                   .withWhisker(WhiskerType.OUTLIER_15_IQR)
                   .back()
               .build()
       
      Returns:
      a new BoxplotChart instance. Never null.
      See Also:
    • newDataTable

      public DataTableChart newDataTable()
      Creates a new DataTableChart builder, the starting point for defining a Data Table, one of the chart types available in the Data Analyzer within Analytics. Unlike other chart types, a Data Table has no X or Y axis. Its series instead defines the table's rows, grouped by one or more dimensions added with DataTableChart.DataTableSeries.addGroupBy(String), and its columns, each an aggregated measure added with DataTableChart.DataTableSeries.addAdditionalMeasure(), which makes it well suited to presenting a detailed, tabular breakdown of a measure across multiple grouping levels, for example revenue by region and then by product.

      Add data to the chart with DataTableChart.addSeries(), then finish the definition with DataTableChart.build(). The resulting chart definition is what Dashboard portlets, quote headers, and other Data Analyzer areas render. The same Groovy code is also what the View Expression function generates when a user builds the equivalent chart in the Pricefx UI.

      This method behaves the same way regardless of execution mode (input generation, syntax check, or distributed calculation). Calling it does not modify any Pricefx data; it only returns a new, independent chart definition builder to continue the fluent chain.

      Example:

      
       api.newChartBuilder().newDataTable()
               .addSeries()
                   .setLabel("Revenue by Region and Product")
                   .setDatamart("datamart_transaction")
                   .setCurrency("USD")
                   .addGroupBy("Region")
                   .addGroupBy("Product")
                   .addAdditionalMeasure()
                       .setMeasure("InvoicePrice")
                       .back()
                   .back()
               .build()
       
      Returns:
      a new DataTableChart instance. Never null.
      See Also:
    • newHeatmap

      public HeatmapChart newHeatmap()
      Creates a new HeatmapChart builder, the starting point for defining a Heatmap, one of the chart types available in the Data Analyzer within Analytics. Unlike other chart types, a Heatmap has exactly one series, obtained with HeatmapChart.getSeries() rather than an addSeries() method, and both its X and Y axes are plain category fields, set with HeatmapChart.HeatmapSeries.setAxisX(String) and HeatmapChart.HeatmapSeries.setAxisY(String). The color of each cell in the resulting grid comes from a separate aggregated measure, the color axis, set with HeatmapChart.HeatmapSeries.setColorAxis(String) and configurable as discrete color bands or a continuous gradient via HeatmapChart.getOptions(), which makes it well suited to visualizing how a measure varies across two categorical dimensions at once, for example revenue by region and product group.

      Finish the definition with HeatmapChart.build(). The resulting chart definition is what Dashboard portlets, quote headers, and other Data Analyzer areas render. The same Groovy code is also what the View Expression function generates when a user builds the equivalent chart in the Pricefx UI.

      This method behaves the same way regardless of execution mode (input generation, syntax check, or distributed calculation). Calling it does not modify any Pricefx data; it only returns a new, independent chart definition builder to continue the fluent chain.

      Example:

      
       api.newChartBuilder().newHeatmap()
               .getSeries()
                   .setLabel("Revenue Heatmap")
                   .setDatamart("datamart_transaction")
                   .setCurrency("USD")
                   .setAxisX("Region")
                   .setAxisY("ProductGroup")
                   .setColorAxis("InvoicePrice")
                       .back()
                   .back()
               .build()
       
      Returns:
      a new HeatmapChart instance. Never null.
      See Also: