ChartGenerator
Creates a raster Line, Bar, Scatter, Histogram or Pie chart based on the values of selected attributes, featuring an interactive interface that allows the user to preview selected features with sample data while designing the layout of their chart. Multiple data series may be specified for plotting on the same chart and many options for chart presentation and labeling are available. This transformer replaces the deprecated WebCharter transformer.
This transformer allows for the creation of 5 different chart types: Line, Scatter, Pie, Bar and Histogram. Different chart specific options are available for each type.
Input Ports
Input data values for the chart can be specified from either attributes or, alternatively, list attributes for compatibility with the WebCharter.
When data is specified from attributes, each specified attribute defines a data series and each feature provides a value in the data series. In this mode, this transformer becomes a blocking transformer, releasing features only after all input features, or all values in the data series, have been received. Thus, the sum of all the input features produce either a single raster chart, or a one per group if Group By is enabled.
When data is specified via list attributes, each feature represents a chart and each list attribute on the feature represents a data series in the chart. In this mode, this transformer becomes non-blocking as a single feature contains all the data needed to generate the chart and one output feature is produced for each input feature. Group By settings are ignored in this mode.
Output Ports
The output of the transformer is raster charts in the form of raster geometries on the features. Each raster feature can be routed to any of FME’s supported image formats such as PNG, JPEG or TIF using the respective writers, or incorporated into a PDF or an Excel report using the PDF writer or the Excel writer along with optional formatting or raster manipulation transformers.
Parameters
Group Processing
If the Group By parameter is set to a set of attributes, one raster per group will be produced. Note that Group By is not applicable if using list attribute input since each input feature already represents a single chart and corresponds to an output feature, so grouping input features is not required.
Process At End (Blocking): This is the default behavior. Processing will only occur in this transformer once all input is present.
Process When Group Changes (Advanced): This transformer will process input groups in order. Changes of the value of the Group By parameter on the input stream will trigger processing on the currently accumulating group. This may improve overall speed (particularly with multiple, equally-sized groups), but could cause undesired behavior if input groups are not truly ordered.
There are two typical reasons for using Process When Group Changes (Advanced) . The first is incoming data that is intended to be processed in groups (and is already so ordered). In this case, the structure dictates Group By usage - not performance considerations.
The second possible reason is potential performance gains.
Performance gains are most likely when the data is already sorted (or read using a SQL ORDER BY statement) since less work is required of FME. If the data needs ordering, it can be sorted in the workspace (though the added processing overhead may negate any gains).
Sorting becomes more difficult according to the number of data streams. Multiple streams of data could be almost impossible to sort into the correct order, since all features matching a Group By value need to arrive before any features (of any feature type or dataset) belonging to the next group. In this case, using Group By with Process At End (Blocking) may be the equivalent and simpler approach.
Note: Multiple feature types and features from multiple datasets will not generally naturally occur in the correct order.
As with many scenarios, testing different approaches in your workspace with your data is the only definitive way to identify performance gains.
Chart Settings
The chart type parameter determines the type of chart that will be created. Depending on the value chosen here, different chart-type-specific options will be available under the Data Series section. Values for chart type currently include Pie, Bar, Histogram, Scatter and Line.
This parameter allows the user to set a title which will appear at the top of the chart.
This option is only enabled when Chart Type is set to Line, Scatter, or Bar. When this option is set to Yes, the user may specify 2 or more data series and may set the data series parameters for each data series individually.
Legend
This option allows for a legend to be generated and displayed with the chart.
If a single data series is plotted, the legend labels will depend on the value of the Chart Type parameter. The Data Attribute name will be used for Bar and Histogram chart types and the Y Attribute will be used for the Line and Scatter chart types. For the Pie chart type, the unique attribute values of Data Attribute will be used.
If multiple data series are plotted, the legend labels will correspond to the data series names.
Note: It is possible to choose Yes for Plot Multiple Data Series, and remove all but one of the data series. This would create a legend label that could be renamed.
This parameter controls the placement of the legend relative to the chart. The default value is Auto Placement, when this option is selected the legend will be placed in a location that minimizes overlaps with data inside the chart. The “Inner” options allow placement within the chart axes, while the “Outer” options place the legend outside the chart axes.
This parameter sets the font used in the legend labels. Note that not all fonts available on your system will work with the underlying charting backend. If a certain font is not supported, it will be defaulted to Arial. The preview will also display a warning if you select an unsupported font. Note that if using FME Server, the fonts available on your server may be different than those available on your desktop.
Axes
For all Chart Types except Pie charts, additional Axes settings can be set, such as X Axis Label and Y Axis Label.
Sets the label along the X axis.
Sets the label along the Y axis.
Sets the font used for the X and Y Axis Labels.
The Ticks/Grid option allows the user to display tick marks when set to Ticks or gridlines along the axes when set to Grid or turn these off when set to None.
Sets the font used for the tick mark labels.
Further there are additional settings which can be set for each axis individually. These include:
Sets the minimum value for the X/Y axis. Note that setting this value may inadvertently crop data. If no value is specified, values will be determined so that all data is included within the limits.
Sets the maximum value for the X/Y axis. Note that setting this value may inadvertently crop data. If no value is specified, values will be determined so that all data is included within the limits.
Sets the spacing between ticks along the X/Y axis.
Allows each axis to be set to Linear or Logarithmic separately. Allows for the creation of logarithmic and semi-log plots.
Controls the angle of the labels along the axis. Options include Horizontal (0), Vertical (90), and Slanted (45). It is also possible to specify a custom value measured in degrees.
Style
This parameter sets the font used in the title. Note that not all fonts available on your system will work with the underlying charting backend. If a certain font is not supported it will be defaulted to Arial. The preview will also display a warning if you select an unsupported font. Note that if using FME Server, the fonts available on your server may be different than those available on your desktop.
This parameter sets the chart-level line width used on the axes and the border of pie slices in pie charts. The default line width is set to 0.5.
This parameter sets the background color of the chart. The default background color is white, with an RGB value of 1.0,1.0,1.0.
Output
These parameters set the width and height of the output image in inches. The default image size is 2 inches by 2 inches with 300 dpi.
Note: Issues may occur if the output image size has a large discrepancy in width and height. As the preview is always a fixed maximum width or height, this ratio is capped at 1:5 to avoid rendering issues. If issues are seen at runtime, try adjusting the size, or making the width and height closer in value.
This parameter sets the dots per inch (dpi) resolution of the output image. The default image size is 2 inches by 2 inches with 300 dpi.
If RGB24 is selected, a 3 band RGB raster is output. If RGBA32 is selected, a 4 band raster with RGB and alpha will be output.
Data Series
The parameters available here depend on the value of the Chart Type parameter. Parameters for each Chart Type are detailed below.
Line
Specifies the attribute whose values will set the X coordinate of the vertices of the line.
Specifies the attribute whose values will set the Y coordinate of the vertices of the line.
Sets the value for the length of error bars corresponding to each vertex by choosing an attribute or list attribute.
Specifies the color of each line. If colors are provided on individual features via the setting of the fme_color attribute, these values will override the color set here.
Sets the pattern on the line. Possible styles are Solid, Dashed, Dotted, and Dash-Dot.
Sets the thickness of the line.
Selects whether the area below the line will be filled in with a semitransparent pattern the same color as the line. This option is turned off by default.
Selects whether the X values are discrete or continuous.
Selects whether the Y values are discrete or continuous.
Selects the shape of the icon at each point. Options include basic symbols such as circle, square, diamond and triangle.
Scatter
Specifies the attribute whose values will set the X coordinate of each point in the scatter plot.
Specifies the attribute whose values will set the Y coordinate of each point in the scatter plot.
Sets the value for the length of error bars corresponding to each vertex by choosing an attribute or list attribute.
Sets the color of the points per data series. If colors are provided on individual features via the setting of the fme_color attribute, these values will override the color set here.
Selects the shape of the icon at each point. Options include basic symbols such as circle, square, diamond and triangle.
Sets the size of the icon at each point.
Specifies whether to plot a line with the equation calculated based on a basic least squares fit of the points. This option is off by default.
Selects whether the X values are discrete or continuous.
Selects whether the Y values are discrete or continuous.
Histogram
Specifies an attribute whose numeric values will be binned to create the histogram.
Specifies the number of bins that will be created for the histogram.
Specifies the color of the histograms bars. The default color is blue. If colors are provided on individual features via the setting of the fme_color attribute, these values will override the color set here.
Specifies whether a line fitting the histogram to a Gaussian will be shown. This option is disabled by default.
Pie
Specifies an attribute whose values will be displayed in the pie chart. The values can be provided in two ways, either through attributes that contain counts, or through repeated attribute values to be enumerated by the transformer.
In the first case, Data Attribute is an attribute containing numeric count values which will determine each pie wedge size, while Label Attribute is set to an attribute whose values contain the respective labels for the counts contained in the data attribute. For example, Data Attribute has values 3, 2, 1 and Label Attribute has values ‘Rain’, ‘Snow’, ‘Hail’.
In the second case, Data Attribute can be set to an attribute containing numeric or non-numeric data, where the count is determined from the count of the unique values, and the values themselves become the labels. Label Attribute is left empty. For example, Data Attribute has values ‘Snow’, ’Snow’, ’Rain’, ’Snow’, ‘Hail’, ‘Snow’, ‘Rain’.
Specifies the labels to be used for each pie wedge when Data Attribute is used to specify the wedge size. If this parameter is empty, each unique value of Data Attribute will be used as a label.
Color Scheme controls the color of the wedges based on a color ramp. If the Take from fme_color option is selected, color values for individual wedges can be supplied via the fme_color attribute. fme_color can be set by using the FeatureColorSetter transformer or by setting the value of this attribute to a valid RGB string (“1,0.5,0.3”, for example).
When this option is selected the percentage corresponding to the size of each wedge will be displayed.
When this is set to Explode Slice, the first wedge will be separated from the rest and the pie will be shaded creating a pseudo 3D effect.
Bar
Specifies an attribute whose values will be displayed in the bar graph. The values can be provided in two ways, either through attributes that contain counts, or through repeated attribute values to be enumerated by the transformer.
In the first case, Data Attribute is an attribute containing numeric count values which will determine each bar size, while Data Label Attribute is set to an attribute whose values contain the respective labels for the counts contained in the data attribute. For example, Data Attribute has values 3, 2, 1 and Data Label Attribute has values ‘Rain’, ‘Snow’, ‘Hail’.
In the second case, Data Attribute can be set to an attribute containing numeric or non-numeric data, where the count is determined from the count of the unique values, and the values themselves become the labels. Data Label Attribute is left empty. For example, Data Attribute has values ‘Snow’, ’Snow’, ’Rain’, ’Snow’, ‘Hail’, ‘Snow’, ‘Rain’.
Specifies the labels to be used for each bar when Data Attribute is used to specify the bar size. If this parameter is empty, each unique value of Data Attribute will be used as a label.
Sets the color of the bars, specified by an RGB String (“0,0,1”, for example). If colors are provided on individual features via the setting of the fme_color attribute, these values will override the color set here.
Sets the chart orientation to be either Horizontal or Vertical.
When set to Yes, data series bars are placed on top of each other as opposed to side by side. This parameter is only available when Plot Multiple Data Series is Yes.
Sets the width of each bar. The width must be between 0.1 and 1.0.
Editing Transformer Parameters
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.
Defining Values
There are several ways to define a value for use in a Transformer. The simplest is to simply type in a value or string, which can include functions of various types such as attribute references, math and string functions, and workspace parameters. There are a number of tools and shortcuts that can assist in constructing values, generally available from the drop-down context menu adjacent to the value field.
Using the Text Editor
The Text Editor provides a convenient way to construct text strings (including regular expressions) from various data sources, such as attributes, parameters, and constants, where the result is used directly inside a parameter.
Using the Arithmetic Editor
The Arithmetic Editor provides a convenient way to construct math expressions from various data sources, such as attributes, parameters, and feature functions, where the result is used directly inside a parameter.
Conditional Values
Set values depending on one or more test conditions that either pass or fail.
Parameter Condition Definition Dialog
Content
Expressions and strings can include a number of functions, characters, parameters, and more.
When setting values - whether entered directly in a parameter or constructed using one of the editors - strings and expressions containing String, Math, Date/Time or FME Feature Functions will have those functions evaluated. Therefore, the names of these functions (in the form @<function_name>) should not be used as literal string values.
These functions manipulate and format strings. | |
Special Characters |
A set of control characters is available in the Text Editor. |
Math functions are available in both editors. | |
Date/Time Functions | Date and time functions are available in the Text Editor. |
These operators are available in the Arithmetic Editor. | |
These return primarily feature-specific values. | |
FME and workspace-specific parameters may be used. | |
Creating and Modifying User Parameters | Create your own editable parameters. |
Dialog Options - Tables
Transformers with table-style parameters have additional tools for populating and manipulating values.
Row Reordering
|
Enabled once you have clicked on a row item. Choices include:
|
Cut, Copy, and Paste
|
Enabled once you have clicked on a row item. Choices include:
Cut, copy, and paste may be used within a transformer, or between transformers. |
Filter
|
Start typing a string, and the matrix will only display rows matching those characters. Searches all columns. This only affects the display of attributes within the transformer - it does not alter which attributes are output. |
Import
|
Import populates the table with a set of new attributes read from a dataset. Specific application varies between transformers. |
Reset/Refresh
|
Generally resets the table to its initial state, and may provide additional options to remove invalid entries. Behavior varies between transformers. |
Note: Not all tools are available in all transformers.
FME Community
The FME Community is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.
Search for samples and information about this transformer on the FME Community.