Difference between revisions of "360Works Charts/Documentation"

From 360Works Product Documentation Wiki
Jump to navigation Jump to search
m (Auto-upload documentation)
m (Auto-upload documentation)
 
Line 72: Line 72:
 
=Function Summary=
 
=Function Summary=
 
<div id="toc">
 
<div id="toc">
*[[#barChartCreate|barChartCreate]] ( name ; categoryAxisLabel ; valueAxisLabel { ; isVertical ; use3d } ) &mdash; Create a bar chart.
 
*[[#barChartSetDataPoint|barChartSetDataPoint]] ( group; category ; value ) &mdash; Set a data point in a bar chart.
 
*[[#barChartSetSeriesColor|barChartSetSeriesColor]] ( category ; red ; green ; blue ; alpha ) &mdash; Set the color that a particular category is displayed in.
 
 
*[[#barChartShowGraphic|barChartShowGraphic]] ( width ; height { ; additionalParams... } ) &mdash; Generates the bar chart containing all previously set data points.
 
*[[#barChartShowGraphic|barChartShowGraphic]] ( width ; height { ; additionalParams... } ) &mdash; Generates the bar chart containing all previously set data points.
 
*[[#chartLastError|chartLastError]] &mdash; Returns the last error which occurred, or "" if there was no error.
 
*[[#chartLastError|chartLastError]] &mdash; Returns the last error which occurred, or "" if there was no error.
 
*[[#chartLicenseInfo|chartLicenseInfo]] &mdash; Returns information about the license used.
 
*[[#chartLicenseInfo|chartLicenseInfo]] &mdash; Returns information about the license used.
 
*[[#chartParam|chartParam]] ( key ; value ) &mdash;  
 
*[[#chartParam|chartParam]] ( key ; value ) &mdash;  
*[[#chartRegister|chartRegister]] ( key ; registeredTo ) &mdash; Registers the Plugin.
 
*[[#chartSetErrorCapture|chartSetErrorCapture]] ( errorCapture ) &mdash; Toggles error dialogs on or off.
 
 
*[[#chartVersion|chartVersion]] &mdash; Returns the version of the plugin.
 
*[[#chartVersion|chartVersion]] &mdash; Returns the version of the plugin.
*[[#lineChartCreate|lineChartCreate]] ( name ; categoryAxisLabel ; valueAxisLabel { ; isVertical ; use3d } ) &mdash; Create a line chart.
 
*[[#lineChartSetDataPoint|lineChartSetDataPoint]] ( seriesName ; category ; value ) &mdash; Set a data point or a return separated list of points in a line chart.
 
*[[#lineChartSetSeriesColor|lineChartSetSeriesColor]] ( category ; red ; green ; blue ; alpha ) &mdash; Set the color that a particular category is displayed in.
 
 
*[[#lineChartShowGraphic|lineChartShowGraphic]] ( width ; height { ; additionalParams... } ) &mdash; Generates the line chart containing all previously set data points.
 
*[[#lineChartShowGraphic|lineChartShowGraphic]] ( width ; height { ; additionalParams... } ) &mdash; Generates the line chart containing all previously set data points.
*[[#pieChartCreate|pieChartCreate]] ( name { ; 3d } ) &mdash; Creates a new pie chart with the given name.
 
*[[#pieChartSetDataPoint|pieChartSetDataPoint]] ( category ; value ) &mdash; Adds a value or a return separated list of values to a pie chart created with the <code>pieChartCreate</code> function.
 
*[[#pieChartSetSeriesColor|pieChartSetSeriesColor]] ( category ; red ; green ; blue ; alpha ) &mdash; Set the color that a particular category is displayed in.
 
 
*[[#pieChartShowGraphic|pieChartShowGraphic]] ( width ; height { ; additionalParams... } ) &mdash; Returns the container image for the currently configured chart.
 
*[[#pieChartShowGraphic|pieChartShowGraphic]] ( width ; height { ; additionalParams... } ) &mdash; Returns the container image for the currently configured chart.
*[[#timeSeriesChartAddRegression|timeSeriesChartAddRegression]] ( seriesName { ; properties } ) &mdash; Adds a regression to the time series.
 
*[[#timeSeriesChartCreate|timeSeriesChartCreate]] ( name ; timeAxisLabel ; valueAxisLabel ) &mdash; Creates a time series chart, for displaying a line chart which displays value information for dates.
 
*[[#timeSeriesChartSetDataPoint|timeSeriesChartSetDataPoint]] ( seriesName ; dateOrTime ; value ) &mdash; Sets a value or a return separated list of values for a specific series and date or return separated list of dates.
 
*[[#timeSeriesChartSetSeriesColor|timeSeriesChartSetSeriesColor]] ( seriesName ; red ; green ; blue ; alpha ) &mdash; Set the color that a particular time series is displayed in.
 
 
*[[#timeSeriesChartShowGraphic|timeSeriesChartShowGraphic]] ( width ; height { ; additionalParams... } ) &mdash; Generates the time series chart containing all previously set data points.
 
*[[#timeSeriesChartShowGraphic|timeSeriesChartShowGraphic]] ( width ; height { ; additionalParams... } ) &mdash; Generates the time series chart containing all previously set data points.
 
</div>
 
</div>
 
=Function Detail=
 
=Function Detail=
<div id="barChartCreate"></div>
 
==barChartCreate ( name ; categoryAxisLabel ; valueAxisLabel { ; isVertical ; use3d } ) ==
 
Create a bar chart.
 
A bar chart looks like this:
 
<img src="images/barchart.png" alt="bar chart" border="1"/>
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>name</code> <dd>the optional name of the chart
 
<dt><code>categoryAxisLabel</code> <dd>the optional label for the category axis of the chart
 
<dt><code>valueAxisLabel</code> <dd>the optional label for the value axis of the chart
 
<dt><code>isVertical</code> <dd>Whether to orient the chart horizontally (0) or vertically (1)
 
<dt><code>use3d</code> <dd>whether to apply a three-dimensional effect to the chart.
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> 1 on success, or "<code>ERROR</code>" if there was a problem (use ChartLastError for more detailed information about the nature of the error).
 
</div>
 
 
<div id="barChartSetDataPoint"></div>
 
==barChartSetDataPoint ( group; category ; value ) ==
 
Set a data point in a bar chart.  Categories are a way to break an item into smaller pieces.  A group can have multiple categories.
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>group</code> <dd>unique group name identifier.
 
<dt><code>category</code> <dd>category name identifier.  Typically, the same categories are repeated for each group.
 
<dt><code>value</code> <dd>the numeric value for the group/category combination
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> 1 on success, or "<code>ERROR</code>" if there was a problem (use ChartLastError for more detailed information about the nature of the error).
 
</div>
 
 
<div id="barChartSetSeriesColor"></div>
 
==barChartSetSeriesColor ( category ; red ; green ; blue ; alpha ) ==
 
Set the color that a particular category is displayed in. You should call chartSetColor AFTER adding values to the
 
chart.
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>category</code> <dd>a category which was set in a previous call to {@link #barChartSetDataPoint(String, String, double)}.
 
<dt><code>red</code> <dd>a number between 0-255
 
<dt><code>green</code> <dd>a number between 0-255
 
<dt><code>blue</code> <dd>a number between 0-255
 
<dt><code>alpha</code> <dd>a number between 0-255 indicating the transparency of the color.  0 is completely transparent.
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> 1 on success, or "<code>ERROR</code>" if there was a problem (use ChartLastError for more detailed information about the nature of the error).
 
</div>
 
 
 
<div id="barChartShowGraphic"></div>
 
<div id="barChartShowGraphic"></div>
 
==barChartShowGraphic ( width ; height { ; additionalParams... } ) ==
 
==barChartShowGraphic ( width ; height { ; additionalParams... } ) ==
Line 173: Line 115:
 
<div class="parameters"><strong>Parameters:</strong>
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl></dl></div>
 
<dl></dl></div>
 
 
<div id="chartRegister"></div>
 
==chartRegister ( key ; registeredTo ) ==
 
Registers the Plugin.
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>licenseKey</code> <dd>a valid license key string, or the literal string "DEMO" to run in demo mode.
 
<dt><code>registeredTo</code> <dd>the company name for the license key used.
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> 1 on success, or &quot;ERROR&quot; on failure.
 
</div>
 
 
<div id="chartSetErrorCapture"></div>
 
==chartSetErrorCapture ( errorCapture ) ==
 
Toggles error dialogs on or off. When something unexpected happens, the plug-in will pop up a dialog displaying the error message. This makes it easy to see what went wrong. However, in some cases, you (the developer) may prefer to show your own message to the user, or possibly not show a message at all. In that case, you can call chartSetErrorCapture with a parameter of true. That will suppress the error dialog from appearing to the user.
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>errorCapture</code> <dd>set to true to suppress the default popups.
 
</dl></div>
 
  
  
Line 200: Line 122:
  
 
<div class="see"><strong>Returns:</strong> a decimal version number.
 
<div class="see"><strong>Returns:</strong> a decimal version number.
</div>
 
 
<div id="lineChartCreate"></div>
 
==lineChartCreate ( name ; categoryAxisLabel ; valueAxisLabel { ; isVertical ; use3d } ) ==
 
Create a line chart.
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>name</code> <dd>The title of the chart
 
<dt><code>categoryAxisLabel</code> <dd>The label for the category axis
 
<dt><code>valueAxisLabel</code> <dd>The label for the value axis
 
<dt><code>isVertical</code> <dd>Whether to orient the line chart vertically or horizontally (pass a 1 for vertical)
 
<dt><code>use3d</code> <dd>whether to apply a three-dimensional effect to the chart
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> 1 on success, or "<code>ERROR</code>" if there was a problem (use ChartLastError for more detailed information about the nature of the error).
 
</div>
 
 
<div id="lineChartSetDataPoint"></div>
 
==lineChartSetDataPoint ( seriesName ; category ; value ) ==
 
Set a data point or a return separated list of points in a line chart.  Categories are a way to break an item into smaller pieces.  A group can have multiple categories.
 
The line will be drawn from left to right in the order items are added.
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>seriesName</code> <dd>the name of the series (or line) that this data point will apply to.
 
<dt><code>category</code> <dd>category name identifier.  This appears in the category axis of the line chart.
 
<dt><code>value</code> <dd>the numeric value for the group/category combination
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> 1 on success, or "<code>ERROR</code>" if there was a problem (use ChartLastError for more detailed information about the nature of the error).
 
</div>
 
 
<div id="lineChartSetSeriesColor"></div>
 
==lineChartSetSeriesColor ( category ; red ; green ; blue ; alpha ) ==
 
Set the color that a particular category is displayed in. You should call chartSetColor AFTER adding values to the
 
chart.
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>category</code> <dd>a category which was set in a previous call to {@link #lineChartSetDataPoint(String, String, String)}.
 
<dt><code>red</code> <dd>a number between 0-255
 
<dt><code>green</code> <dd>a number between 0-255
 
<dt><code>blue</code> <dd>a number between 0-255
 
<dt><code>alpha</code> <dd>a number between 0-255 indicating the transparency of the color.  0 is completely transparent.
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> 1 on success, or "<code>ERROR</code>" if there was a problem (use ChartLastError for more detailed information about the nature of the error).
 
 
</div>
 
</div>
  
Line 260: Line 140:
 
</dl></div>
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> an image containing the chart of the supplied dimensions.
 
<div class="see"><strong>Returns:</strong> an image containing the chart of the supplied dimensions.
</div>
 
 
<div id="pieChartCreate"></div>
 
==pieChartCreate ( name { ; 3d } ) ==
 
Creates a new pie chart with the given name.  This function must be called before adding data to the chart, modifying colors or display options, or displaying the chart graphic.
 
A pie chart looks like this:
 
<img src="images/piechart.png" alt="pie chart" border="1"/>
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>name</code> <dd>The optional name of the chart.
 
<dt><code>use3d</code> <dd>whether to use a three-dimensional effect on the chart.
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> 1 on success, or "<code>ERROR</code>" if there was a problem (use ChartLastError for more detailed information about the nature of the error).
 
</div>
 
 
<div id="pieChartSetDataPoint"></div>
 
==pieChartSetDataPoint ( category ; value ) ==
 
Adds a value or a return separated list of values to a pie chart created with the <code>pieChartCreate</code> function.
 
Calling this twice with the same category name will overwrite the previously set value.
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>category</code> <dd>category name
 
<dt><code>value</code> <dd>The numeric value for the category.
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> 1 on success, or "<code>ERROR</code>" if there was a problem (use ChartLastError for more detailed information about the nature of the error).
 
</div>
 
 
<div id="pieChartSetSeriesColor"></div>
 
==pieChartSetSeriesColor ( category ; red ; green ; blue ; alpha ) ==
 
Set the color that a particular category is displayed in. You should call chartSetColor AFTER adding values to the
 
chart.
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>category</code> <dd>a category which was set in a previous call to {@link #pieChartSetDataPoint(String, String)}.
 
<dt><code>red</code> <dd>a number between 0-255
 
<dt><code>green</code> <dd>a number between 0-255
 
<dt><code>blue</code> <dd>a number between 0-255
 
<dt><code>alpha</code> <dd>a number between 0-255 indicating the transparency of the color.  0 is completely transparent.
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> 1 on success, or "<code>ERROR</code>" if there was a problem (use ChartLastError for more detailed information about the nature of the error).
 
 
</div>
 
</div>
  
Line 317: Line 157:
 
</dl></div>
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> the chart image
 
<div class="see"><strong>Returns:</strong> the chart image
</div>
 
 
<div id="timeSeriesChartAddRegression"></div>
 
==timeSeriesChartAddRegression ( seriesName { ; properties } ) ==
 
Adds a regression to the time series. This should be called AFTER setting all time series data points.
 
 
The valid properties are:
 
<ul>
 
<li>name: the name of the regression (this appears in the legend)</li>
 
<li>color: the color of the regression line. This should be a color name (e.g. pink, red, blue, yellow, etc).</li>
 
</ul>
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>seriesName</code> <dd>the name of the series to add the regression to.  If blank, the first series is used.
 
<dt><code>properties</code> <dd>optional arguments
 
</dl></div>
 
<div class="see"><strong>Returns:</strong>
 
</div>
 
 
<div id="timeSeriesChartCreate"></div>
 
==timeSeriesChartCreate ( name ; timeAxisLabel ; valueAxisLabel ) ==
 
Creates a time series chart, for displaying a line chart which displays value information for dates.
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>name</code> <dd>The optional name of the chart (this will be displayed in the chart header)
 
<dt><code>timeAxisLabel</code> <dd>the optional label for the time axis
 
<dt><code>valueAxisLabel</code> <dd>the optional label for the value axis
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> 1 on success, or "<code>ERROR</code>" if there was a problem (use ChartLastError for more detailed information about the nature of the error).
 
</div>
 
 
<div id="timeSeriesChartSetDataPoint"></div>
 
==timeSeriesChartSetDataPoint ( seriesName ; dateOrTime ; value ) ==
 
Sets a value or a return separated list of values for a specific series and date or return separated list of dates. Note that if passing in a list of values make sure to passin a corresponding list of dates.
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>seriesName</code> <dd>The series name (or line) whose value is being set.
 
<dt><code>date</code> <dd>the date whose value is being set.
 
<dt><code>value</code> <dd>the value of the series on the specified date
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> 1 on success, or "<code>ERROR</code>" if there was a problem (use ChartLastError for more detailed information about the nature of the error).
 
</div>
 
 
<div id="timeSeriesChartSetSeriesColor"></div>
 
==timeSeriesChartSetSeriesColor ( seriesName ; red ; green ; blue ; alpha ) ==
 
Set the color that a particular time series is displayed in.  You should call chartSetColor AFTER adding values to the chart.
 
 
<div class="parameters"><strong>Parameters:</strong>
 
<dl><dt><code>seriesName</code> <dd>a seriesName which was set in a previous call to {@link #timeSeriesChartSetDataPoint(String, String, String)}.
 
<dt><code>red</code> <dd>a number between 0-255
 
<dt><code>green</code> <dd>a number between 0-255
 
<dt><code>blue</code> <dd>a number between 0-255
 
<dt><code>alpha</code> <dd>a number between 0-255 indicating the transparency of the color.  0 is completely transparent.
 
</dl></div>
 
<div class="see"><strong>Returns:</strong> 1 on success, or "<code>ERROR</code>" if there was a problem (use ChartLastError for more detailed information about the nature of the error).
 
 
</div>
 
</div>
  

Latest revision as of 03:53, 7 June 2017

360Works Charts User Guide

ChartPlugin is a Filemaker Plugin for generating various types of graphical charts. Currently supported are: pie charts, bar charts, line charts, and time series chart.

Before creating a chart, you must register the plugin using chartRegister

The charting API is split into sections corresponding to each type of chart. In general, you call a method to create a chart, then populate data points, set color options, and generate the graphic.

Example Usage

Here is an example for creating a pie chart containing five values. The let() function is used to do the setup for the chart, and then the pieChartShowGraphic is called at the end to set the actual value of the container to the chart image.

Set Variable [ $result = Let(
debug = pieChartCreate( "Quoted Hours Worked" ) and
    pieChartSetDataPoint( Name 1 ; Quoted 1 ) and
    pieChartSetDataPoint( Name 2 ; Quoted 2 ) and
    pieChartSetDataPoint( Name 3 ; Quoted 3 ) and
    pieChartSetDataPoint( Name 4 ; Quoted 4 ) and
    pieChartSetDataPoint( Name 5 ; Quoted 5 );
    pieChartShowGraphic( 360; 360 )
)


Custom parameters

The core charting API deals with the most common tasks. For additional flexibility, you can pass multiple extra parameters to the *ChartShowGraphic functions. The following is a list of all parameters:

legend
Set this to "false" to hide the legend at the bottom of the chart.
explodeSeries
causes one "slice" of a pie chart to appear offset from the center of the chart. The value can be a name or numeric index.
strokeWidth
The width of the stroke used to outline the parts of the chart.
backgroundColor
The background color of the chart. Pass in three numeric values, e.g. 64,128,255
plotBackgroundColor
The background color of the plot area (excluding the headers and legends). Pass in three numeric values, e.g. 64,128,255
noDataMessage
The message to display when there is no data to display in the chart
label
A template string which is used to generate chart labels. For pie charts, {0} is replace with the item name, {1} is the numeric amount, and {2} is the percent amount.
outline
1 or 0 to show/hide a single border around the chart, but within the legend.
outlines
1 or 0 to enable/disable outlines around individual chart elements (for pie charts only)
hideLabels
Whether to hide labels on the chart (for pie charts only)
valueAxis.min
The minimum range to use on the value axis (instead of auto-range)
valueAxis.max
The maximum range to use on the value axis (instead of auto-range)
valueAxis.showTickLabels
true/false to enable/disable the tick labels in the value axis
valueAxis.showTickMarks
true/false to enable/disable the tick marks in the value axi

To use this, simply pass any number of parameters as key/vaue pairs, for example:

Set Variable [$result = Let(
debug = pieChartCreate( "Quoted Hours Worked" ) and
    pieChartSetDataPoint( Name 1 ; Quoted 1 ) and
    pieChartSetDataPoint( Name 2 ; Quoted 2 ) and
    pieChartSetDataPoint( Name 3 ; Quoted 3 ) and
    pieChartSetDataPoint( Name 4 ; Quoted 4 ) and
    pieChartSetDataPoint( Name 5 ; Quoted 5 )
;
pieChartShowGraphic(
    360 ;
    360 ;
    "explodeSeries=" & Name 1 ; // explode the first series
    "backgroundColor=100,100,255") ; // light-blue background
    "outline=false" // don't show an outline
    "legend=false" // don't show the legend
)
)
]



360Works Plugin Setup Guides

See Plugins_101 for Error reporting, installation, registration, and more.

Function Summary

  • barChartShowGraphic ( width ; height { ; additionalParams... } ) — Generates the bar chart containing all previously set data points.
  • chartLastError — Returns the last error which occurred, or "" if there was no error.
  • chartLicenseInfo — Returns information about the license used.
  • chartParam ( key ; value ) —
  • chartVersion — Returns the version of the plugin.
  • lineChartShowGraphic ( width ; height { ; additionalParams... } ) — Generates the line chart containing all previously set data points.
  • pieChartShowGraphic ( width ; height { ; additionalParams... } ) — Returns the container image for the currently configured chart.
  • timeSeriesChartShowGraphic ( width ; height { ; additionalParams... } ) — Generates the time series chart containing all previously set data points.

Function Detail

barChartShowGraphic ( width ; height { ; additionalParams... } )

Generates the bar chart containing all previously set data points.

See the Custom Parameters section for a list of parameters which this function accepts.

Parameters:
width
the width of the resulting image
height
the height of the resulting image
additionalParams
additional parameters
width
Returns: an image containing the chart of the supplied dimensions.

chartLastError

Returns the last error which occurred, or "" if there was no error.


chartLicenseInfo

Returns information about the license used.


chartParam ( key ; value )

Parameters:


chartVersion

Returns the version of the plugin.

Returns: a decimal version number.

lineChartShowGraphic ( width ; height { ; additionalParams... } )

Generates the line chart containing all previously set data points.


The additionalParams are optional parameters which can be used to customize the chart display.

See the Custom Parameters section for a list of parameters which this function accepts.

Parameters:
width
width
the width of the resulting image
height
the height of the resulting image
additionalParams
additional parameters
Returns: an image containing the chart of the supplied dimensions.

pieChartShowGraphic ( width ; height { ; additionalParams... } )

Returns the container image for the currently configured chart. Note that this also releases any resources used by the chart, so it can only be called once.

The additionalParams are optional parameters which can be used to customize the chart display.

See the Custom Parameters section for a list of parameters which this function accepts.

Parameters:
width
height
additionalParams
additional parameters which customize how the chart is generated
Returns: the chart image

timeSeriesChartShowGraphic ( width ; height { ; additionalParams... } )

Generates the time series chart containing all previously set data points.

The additionalParams are optional parameters which can be used to customize the chart display.

See the Custom Parameters section for a list of parameters which this function accepts.

Parameters:
width
width
the width of the resulting image
height
the height of the resulting image
additionalParams
additional parameters
Returns: an image containing the chart of the supplied dimensions.