Chart.php
Chart functions for Wizard’s Toolkit
All rights reserved.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Tags
Table of Contents
- wtkGraphValues() : null
- Graph Values for Chart.js and MaterializeCSS
- wtkRptChart() : html
- Single line call to generate multiple charts for a single set of data.
Functions
wtkGraphValues()
Graph Values for Chart.js and MaterializeCSS
wtkGraphValues
(
string
$fncSQL
,
array<string|int, mixed>
$fncSqlFilter
[,
string
$fncDateFormat =
'' ]
) : null
This can be used to retrieve proper syntax for Chart.js Charts.
Calling method: $pgGraph = wtkGraphValues($pgSQL, $pgSqlFilter);
Parameters
- $fncSQL : string
-
SQL SELECT
- $fncSqlFilter : array<string|int, mixed>
-
array that has PDO names of fields and their values
- $fncDateFormat : string = ''
-
If first column is a date you can pass in the format you want the date displayed
Return values
null —wtkRptChart()
Single line call to generate multiple charts for a single set of data.
wtkRptChart
(
string
$fncSQL
,
array<string|int, mixed>
$fncSqlFilter
[,
string
$fncRptId =
'wtkRpt1'
][,
string
$fncDateFormat =
'' ]
[,
array<string|int, mixed>
$fncChartOps =
[] ]
,
string
$fncChartNum)
: html
This calls wtkBuildDataBrowse to generate a list of data and wtkGraphValues to make charts in conjunction with HTML and JS as defined in wtk/htm/chartJS.htm.
Calling example:
$pgChartOps = array('regRpt','pie','bar','line');
$pgHtm .= wtkRptChart($pgSQL, $pgSqlFilter, $pgRpt . 'Rpt', '', $pgChartOps, $pgRptNum);
Parameters
- $fncSQL : string
-
SQL SELECT
- $fncSqlFilter : array<string|int, mixed>
-
array that has PDO names of fields and their values
- $fncRptId : string = 'wtkRpt1'
-
only need to pass if have more than one report on page
- $fncDateFormat : string = ''
-
If first column is a date you can pass in the format you want the date displayed
- $fncChartOps : array<string|int, mixed> = []
-
If not passed then all chart types will be shown; this allows choosing which charts to show.
- $fncChartNum : string
-
defaults to 0 and is used if more than one chart on page
Tags
Return values
html —and charts