{"id":18678133,"url":"https://github.com/zingchart/zingchart-php","last_synced_at":"2025-04-12T02:40:32.201Z","repository":{"id":57091386,"uuid":"60303960","full_name":"zingchart/ZingChart-PHP","owner":"zingchart","description":"Wrapper for ZingChart for easy chart manipulation and interactivity for PHP users.","archived":false,"fork":false,"pushed_at":"2019-02-06T22:15:30.000Z","size":34,"stargazers_count":44,"open_issues_count":1,"forks_count":15,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-11T19:08:47.748Z","etag":null,"topics":["charts","php","zingchart"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zingchart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-02T23:26:17.000Z","updated_at":"2024-02-20T21:32:59.000Z","dependencies_parsed_at":"2022-08-22T20:40:30.076Z","dependency_job_id":null,"html_url":"https://github.com/zingchart/ZingChart-PHP","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zingchart%2FZingChart-PHP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zingchart%2FZingChart-PHP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zingchart%2FZingChart-PHP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zingchart%2FZingChart-PHP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zingchart","download_url":"https://codeload.github.com/zingchart/ZingChart-PHP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248507465,"owners_count":21115605,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["charts","php","zingchart"],"created_at":"2024-11-07T09:36:08.161Z","updated_at":"2025-04-12T02:40:32.182Z","avatar_url":"https://github.com/zingchart.png","language":"PHP","readme":"# PHP Wrapper for ZingChart\n\nThe purpose of this wrapper is to enable PHP users to quickly and easily create interactive charts using nothing but PHP code. **No JavaScript required.**\n\n## Initial Setup\n\n### Manual\n\n1. Download this repo by clicking on the green \"Clone or download\" button near the top of this page.\n1. Click on \"Download Zip\" option to begin the download.\n1. Copy file \"ZC.php\" into your project's source directory.\n1. Include the ZingChart library in your project `\u003cscript src=\"//cdn.zingchart.com/zingchart.min.js\"\u003e\u003c/script\u003e`.\n1. Include this wrapper in your project using the 'include' syntax. ie) `include ZC.php`.\n1. After the include use the proper namespace in your code: `use ZingChart\\PHPWrapper\\ZC;`.\n\n```php\ninclude 'ZC.php';\nuse ZingChart\\PHPWrapper\\ZC;\n\n$datay = array();\n$a = 6.619;\n$b = 0.113;\n$index = 0;\nfor ($x = 50; $x \u003c 600; $x += 50, $index++) {\n    array_push($datay, $a + $b*$x);\n}\n\n$zc = new ZC(\"myChart\");\n$zc-\u003esetChartType(\"line\");\n$zc-\u003esetTitle(\"PHP 5.6 render\");\n$zc-\u003esetSeriesData(0, $datay);\n$zc-\u003esetChartHeight(\"400px\");\n$zc-\u003esetChartWidth(\"100%\");\n$zc-\u003erender();\n```\n\n### Composer\nWe are on Packagist [here](https://packagist.org/packages/zingchart/php_wrapper).\n\n1. Download this package with Composer: `composer require zingchart/php_wrapper`.\n1. AutoLoad your package dependencies in your project: `require __DIR__ . '/vendor/autoload.php;`.\n1. Reference this library in your code: `use ZingChart\\PHPWrapper\\ZC;`.\n\n\n## Quick Start\n\n### Pulling plot data from MySQL:\n\n```php\n$zc = new ZC(\"myChart\");\n$zc-\u003econnect($host,$port,$uName,$pswd,$db);\n$data = $zc-\u003equery($mySqlQuery, true);\n$zc-\u003esetSeriesData($data[1]);\n$zc-\u003erender();\n$zc-\u003ecloseConnection();\n```\n\n**Code Breakdown:**\n\n1. `$zc = new ZC(\"myChart\");`  \nInstantiate a new instance of the ZC object with the id of the html element you wish to embed your chart in. For example, `\u003cdiv id=\"myChart\"\u003e\u003c/div\u003e`.\n1. `$zc-\u003econnect($host,$port,$uname,$pswd,$db);`  \nEstablish a connection to your db.\n1. `$data = $zc-\u003equery($mySqlQuery, $scaleXLabelsFlag);`  \nQuery the db with a valid SQL query string and set returned value to a variable.  \n***Note:*** *The second argument to this function accepts a boolean that tells this function whether the first field returned from the SQL query should be treated as the scaleXLabels.*\n1. `$zc-\u003esetSeriesData($data[1]);`  \nSet the plot data with the data stored from your sql query, ie. $data[1] is the plot data and  $data[0] in this case holds the x-axis scale labels. This is because we set the $scaleXLabelsFlag to 'true' so our first dataset in our array will hold these labels in an array at index 0. And the plot data is stored in another array at index 1.\n1. `$zc-\u003erender();`  \nRender your data as the default 'Area' chart type. If you wish to use a different chart type then simply set it either using another function call `$zc-\u003esetChartType(\"bar\");` or via overloading the constructor method `$zc = new ZC(\"myChart\", \"bar\");`.\n1. `$zc-\u003ecloseConnection();`  \nBe sure to close your database connection once you are done using it.\n\n### Plotting data without a MySQL database:\n\n```php\n$zc = new ZC(\"myChart\");\n$zc-\u003esetSeriesData([1,4,2,6,3]);\n$zc-\u003erender();\n```\n\n**Code Breakdown:**\n\n1. `$zc = new ZC(\"myChart\");`  \nInstantiate a new instance of the ZC object with the id of the html elemet you wish to embed your chart in. For example, `\u003cdiv id=\"myChart\"\u003e\u003c/div\u003e`.\n1. `$zc-\u003esetSeriesData(0, [1,4,2,6,3]);`  \nSet the plot data with an array of values. You can even use an array of arrays to plot multiple series like this: `$zc-\u003esetSeriesData([[12,35,24],[3,9,7]);`\n1. `$zc-\u003erender();`  \nRender your data as the default 'Area' chart type. If you wish to use a different chart type then simply set it either using another function call `$zc-\u003esetChartType(\"bar\");` or via overloading the constructor `$zc = new ZC(\"myChart\", \"bar\");`.\n\n### Live Demos\n* [PHP Wrapper](https://examples.zingchart.com/dashboards/php-wrapper)\n    * [or just the code](https://gist.github.com/jbogartPint/884d092e2e4037c76255ac0610afb74a)\n* [Dashboard](https://examples.zingchart.com/dashboards/php)\n\n\n## Usage\n\nConstructor:  \n**[ZC](#ZC)** - The constructor for ZingChart. Overloading is possible.\n\nThere are three levels of usability for this wrapper: \n\n* **Level 1** - Built-in functions that set and get chart data. \n***Limited*** *library functionality.*\n\n\t**[render](#render)** - Renders the chart. This method must be called last, after you have optionally configured your chart.  \n\t\n\t**[connect](#connect)** - Establishes a connection to your MySQL database.  \n\t**[closeConnection](#closeConnection)** - Closes the connection to your MySQL database.  \n\t**[query](#query)** - Queries your database and returns your data in the form of an array.  \n\t**[getFieldNames](#getFieldNames)** - Get the MySQL field names returned from the function query above.  \n\t\n\t**[setTitle](#setTitle)**           - Sets the chart title. Expected arg: String.  \n\t**[setSubtitle](#setSubtitle)**        - Sets the chart subtitle. Expected arg: String.  \n\t**[setLegendTitle](#setLegendTitle)**     - Sets the chart legend's title. Expected arg: String.  \n\t**[setScaleXTitle](#setScaleXTitle)**     - Sets the chart x-axis title.  \n\t**[setScaleYTitle](#setScaleYTitle)**     - Sets the chart y-axis title.  \n\t**[setScaleXLabels](#setScaleXLabels)**    - Sets the chart x-axis' scale values.  \n\t**[setScaleYLabels](#setScaleYLabels)**    - Sets the chart y-axis' scale values.  \n\t**[setSeriesData](#setSeriesData)**      - Sets the chart plot data. ie) The data to be plotted.  \n\t**[setSeriesText](#setSeriesText)**      - Sets the chart data labels. ie) Used for tooltips, valueBox, etc..  \n\t\n\t**[setChartType](#setChartType)**       - Sets the chart type. ie) Area, Bar, Line, Pie, etc..  \n\t**[setChartWidth](#setChartWidth)**      - Sets the chart width. ***Note:*** *Defaults to 100%.*  \n\t**[setChartHeight](#setChartHeight)**     - Sets the chart height. ***Note:*** *Defaults to 400px.*  \n\t**[setChartTheme](#setChartTheme)**      - Sets the chart color theme. ie) light, dark, classic.  \n\t**[setFullscreen](#setFullscreen)**\t    - Sets the chart's width and height to fit the window.  \n\t\n\t**[enableScaleXZooming](#enableScaleXZooming)**  - Turn on chart zooming on x-axis.  \n\t**[enableScaleYZooming](#enableScaleYZooming)**  - Turn on chart zooming on y-axis.  \n\t**[enableCrosshairX](#enableCrosshairX)**     - Turn on chart crosshair guide on x-axis. ***NOTE:*** *On by default.*  \n\t**[enableCrosshairY](#enableCrosshairY)**     - Turn on chart crosshair guide on y-axis.  \n\t**[enableTooltip](#enableTooltip)**        - Turn on chart tooltip.  \n\t**[enableValueBox](#enableValueBox)**       - Turn on chart valueBox.  \n\t**[enablePreview](#enablePreview)**        - Turn on chart preview area.  \n\n\t**[disableScaleXZooming](#disableScaleXZooming)** - Turn off chart zooming on x-axis.  \n\t**[disableScaleYZooming](#disableScaleYZooming)** - Turn off chart zooming on y-axis.  \n\t**[disableCrosshairX](#disableCrosshairX)**    - Turn off chart crosshair on x-axis.  \n\t**[disableCrosshairY](#disableCrosshairY)**    - Turn off chart crosshair on y-axis.  \n\t**[disableTooltip](#disableTooltip)**       - Turn off chart tooltip.  \n\t**[disableValueBox](#disableValueBox)**      - Turn off chart valueBox.  \n\t**[disablePreview](#disablePreview)**       - Turn off chart preview area.  \n\t\n\t**[getTitle](#getTitle)**             - Get the chart title.  \n\t**[getSubtitle](#getSubtitle)**          - Get the chart subtitle.  \n\t**[getLegendTitle](#getLegendTitle)**       - Get the chart legend title.  \n\t**[getConfig](#getConfig)**            - Get the chart JSON configuration.  \n\t**[getScaleXTitle](#getScaleXTitle)**       - Get the chart x-axis title.  \n\t**[getScaleYTitle](#getScaleYTitle)**       - Get the chart y-axis title.  \n\t**[getScaleXLabels](#getScaleXLabels)**      - Get the chart x-axis scale values.  \n\t**[getScaleYLabels](#getScaleYLabels)**      - Get the cahrt y-axis scale values.  \n\t**[getSeriesData](#getSeriesData)**        - Get the chart plot data/values.  \n\t**[getSeriesText](#getSeriesText)**        - Get the chart plot data labels/texts.  \n\n* **Level 2** - Using dot syntax to set more in-depth chart data. ***No limitation*** *on original library functionality.*\n\n\t**[setConfig](#setConfig)** - This function allows you to set a value for a single chart property using dot-notation.\n\n* **Level 3** - Full-blown JSON syntax to have full control. ***No limitation*** *on original library functionality.*\n\n\t**[trapdoor](#trapdoor)** - This function allows you to set the entire chart's configuration with a single function call.\n\n## Documentation\n\n\u003ca id=\"ZC\"\u003e\u003c/a\u003e\n### ZC ( elemId [,chartType=\"area\" [,theme=\"light\" [,width=\"100%\" [,height=\"400\"]]]] ) `Contructor`\n\n**Default Behavior:**\nThis method is overloaded to accept: 1, 2, 3, 4, or 5 arguments. Argument order matters. See examples below.\n\n**Examples:**\n\n```php\n$zc = new ZC(\"chartDiv\");\n$zc = new ZC(\"chartDiv\", \"line\");\n$zc = new ZC(\"chartDiv\", \"line\", \"dark\");\n$zc = new ZC(\"chartDiv\", \"line\", \"dark\", \"600\");\n$zc = new ZC(\"chartDiv\", \"line\", \"dark\", \"600\", \"400\");\n$zc = new ZC(\"chartDiv\", null, \"dark\");\n$zc = new ZC(\"chartDiv\", \"bar\", null, 600, 400);\n```\n\n*NOTE: The first argument is required to render your chart properly. This first argument corresponds to the id of the html element you wish to put your chart into.*\n\n---\n\u003ca id=\"render\"\u003e\u003c/a\u003e\n### render ( ) `Level 1`\nRenders the chart to the html element specified from the constructor.\n\n**Example:**\n\n```php\n$zc-\u003erender();\n```\n\n---\n\u003ca id=\"getRenderScript\"\u003e\u003c/a\u003e\n### getRenderScript ( ) `Level 1`\nThis function returns the text that would be printed by the render function.\n\n**Example:**\n\n```php\n$chart1Script = $zc-\u003egetRenderScript();// This stores the script, to be printed later\necho $chart1Script;// This will render the chart\n```\n\n---\n\u003ca id=\"connect\"\u003e\u003c/a\u003e\n### connect ( host, port, username, pswd, db ) `Level 1`\n\nEstablishes a connection to your MySQL database.\n\n**Example:**\n\n```php\n$zc-\u003econnect(\"127.0.0.1\",\"8889\",\"root\",\"root\",\"mydb\");\n```\n\n---\n\u003ca id=\"closeConnection\"\u003e\u003c/a\u003e\n### closeConnection ( ) `Level 1`\nCloses the connection to your MySQL database.\n\n**Example:**\n\n```php\n$zc-\u003ecloseConnection();\n```\n\n---\n\u003ca id=\"query\"\u003e\u003c/a\u003e\n### query ( sqlQuery, scaleXLabelsFlag ) `Level 1`\nQueries your MySQL database with your supplied query string. ***Note:*** *Accepts a second argument that expects a boolean representing whether or not to treat the first field returned from your SQL query as the x-axis scale labels.*\n\n**Example:**\n\n```php\n$queryStr = \"SELECT timestamp, unitsSold, expected, anotherMetric FROM feed_data\";\n$zc-\u003equery($queryStr, true);\n```\n\nIn the code snippet above, we set the scaleXLabelsFlag to true because our SQL query returns 'timestamps' data that we wish to set as our x-axis scale labels. If we did not want to explicitly set the x-axis labels then the code could look like this:\n\n```php\n$queryStr = \"SELECT unitsSold, expected, anotherMetric FROM feed_data\";\n$zc-\u003equery($queryStr, false);\n```\n\n---\n\u003ca id=\"getFieldNames\"\u003e\u003c/a\u003e\n### getFieldNames ( ) `Level 1`\nGet the MySQL field names returned from the function query above.\n\n**Example:**\n\n```php\n$fieldNames = $zc-\u003egetFieldNames();\n```\n\n---\n\u003ca id=\"setTitle\"\u003e\u003c/a\u003e\n### setTitle ( theChartTitle ) `Level 1`\nSets the chart title. Expected arg: String.\n\n**Example:**\n\n```php\n$zc-\u003esetTitle(\"Sandwiches Consumed\");\n```\n\n---\n\u003ca id=\"setSubtitle\"\u003e\u003c/a\u003e\n### setSubtitle ( theSubtitle ) `Level 1`\nSets the chart subtitle. Expected arg: String.\n\n**Example:**\n\n```php\n$zc-\u003esetSubtitle(\"March 1 thru March 31, 2016\");\n```\n\n---\n\u003ca id=\"setLegendTitle\"\u003e\u003c/a\u003e\n### setLegendTitle ( theLegendTitle ) `Level 1`\nSets the chart legend's title. Expected arg: String.\n\n**Example:**\n\n```php\n$zc-\u003esetLegendTitle(\"Sandwich Types\");\n```\n\n---\n\u003ca id=\"setScaleXTitle\"\u003e\u003c/a\u003e\n### setScaleXTitle ( xAxisTitle ) `Level 1`\nSets the chart x-axis title.\n\n**Example:**\n\n```php\n$zc-\u003esetScaleXTitle(\"Quantity\");\n```\n\n---\n\u003ca id=\"setScaleYTitle\"\u003e\u003c/a\u003e\n### setScaleYTitle ( yAxisTitle ) `Level 1`\nSets the chart y-axis title.\n\n**Example:**\n\n```php\n$zc-\u003esetScaleYTitle(\"Date\");\n```\n\n---\n\u003ca id=\"setScaleXLabels\"\u003e\u003c/a\u003e\n### setScaleXLabels ( xAxisLabels ) `Level 1`\nSets the chart x-axis' scale values.\n\n**Example:**\n\n```php\n$zc-\u003esetScaleXLabels(array(\"Mar 1\", \"Mar 2\", \"Mar 3));\n```\n\n---\n\u003ca id=\"setScaleYLabels\"\u003e\u003c/a\u003e\n### setScaleYLabels ( yAxisValueRange ) `Level 1`\nSets the chart y-axis' scale value range and increment. \n\n**Example:**\n\n```php\n$zc-\u003esetScaleYLabels(array(\"0:10:100\");\n```\n\n---\n\u003ca id=\"setSeriesData\"\u003e\u003c/a\u003e\n### setSeriesData ( [,seriesIndex], plotDataArray ) ```Level 1```\nSets the chart plot data. ie) The data to be plotted.\nseriesIndex is an optional parameter. If ommited, the function will assume plotDataArray contain \nall the data for all the series.\n\n**Examples:**\n\n```php\n$zc-\u003esetSeriesData(0, [5,7,11]);\n$zc-\u003esetSeriesData([[3,7,1], [20,32,37], [1,25,48]]);\n```\n\n---\n\u003ca id=\"setSeriesText\"\u003e\u003c/a\u003e\n### setSeriesText ( [,seriesIndex], seriesText ) `Level 1`\nSets the chart data labels. ie) Used for tooltips, valueBox, etc..\nThere are two ways to overload this function.\n\n1.\tOne argument - ([]) : an array of values. Will apply each element of this array to \n\tthe corresponding series text.\n2.\tTwo arguments - (i, \"value\") : i is the index of the series to apply \"value\" towards.\n\n**Examples:**\n\n```php\n$zc-\u003esetSeriesText([\"BLT\",\"Tuna\",\"Club\"]); // applies \"BLT\" to series[0], \"Tuna\" to series[1],..\n$zc-\u003esetSeriesText(0, \"BLT\");              // applies \"BLT\" to series[0]\n```\n\n---\n\u003ca id=\"setChartType\"\u003e\u003c/a\u003e\n### setChartType ( theType ) `Level 1`\nSets the chart type. ie) Area, Bar, Line, Pie, etc..\n\n**Example:**\n\n```php\n$zc-\u003esetChartType(\"line\");\n```\n\n---\n\u003ca id=\"setChartWidth\"\u003e\u003c/a\u003e\n### setChartWidth ( chartWidth ) `Level 1`\nSets the chart width. ***Note:*** *Defaults to 100%.*\n\n**Examples:**\n\n```php\n$zc-\u003esetChartWidth(\"600\"); // in pixels\n$zc-\u003esetChartWidth(\"100%\");\n```\n\n---\n\u003ca id=\"setChartHeight\"\u003e\u003c/a\u003e\n### setChartHeight ( chartHeight ) `Level 1`\nSets the chart height. ***Note:*** *Defaults to 400px.*\n\n**Examples:**\n\n```php\n$zc-\u003esetChartHeight(\"400\"); // in pixels\n$zc-\u003esetChartHeight(\"50%\");\n```\n\n---\n\u003ca id=\"setChartTheme\"\u003e\u003c/a\u003e\n### setChartTheme ( chartTheme ) `Level 1`\nSets the chart color theme. ie) light, dark, classic\n\n**Limited Options:**\n`\"light\" | \"dark\" | \"classic\"`\n\n**Example:**\n\n```php\n$zc-\u003esetChartTheme(\"dark\");\n```\n\n---\n\u003ca id=\"setFullscreen\"\u003e\u003c/a\u003e\n### setFullscreen ( ) `Level 1`\nToggles the chart to fit the window. Calling this method twice will disable fullscreen.\n\n**Example:**\n\n```php\n$zc-\u003esetFullscreen();\n```\n\n---\n\n\u003ca id=\"enableScaleXZooming\"\u003e\u003c/a\u003e\n### enableScaleXZooming ( ) `Level 1`\nTurn on chart zooming on x-axis.\n\n**Example:**\n\n```php\n$zc-\u003eenableScaleXZooming();\n```\n\n---\n\u003ca id=\"enableScaleYZooming\"\u003e\u003c/a\u003e\n### enableScaleYZooming ( ) `Level 1`\nTurn on chart zooming on y-axis.\n\n**Example:**\n\n```php\n$zc-\u003eenableScaleYZooming();\n```\n\n---\n\u003ca id=\"enableCrosshairX\"\u003e\u003c/a\u003e\n### enableCrosshairX ( ) `Level 1`\nTurn on chart crosshair guide on x-axis. ***NOTE:*** *On by default.*\n\n**Example:**\n\n```php\n$zc-\u003eenableCrosshairX();\n```\n\n---\n\u003ca id=\"enableCrosshairY\"\u003e\u003c/a\u003e\n### enableCrosshairY ( ) `Level 1`\nTurn on chart crosshair guide on y-axis.\n\n**Example:**\n\n```php\n$zc-\u003eenableCrosshairY();\n```\n\n---\n\u003ca id=\"enableTooltip\"\u003e\u003c/a\u003e\n### enableTooltip ( ) `Level 1`\nTurn on chart tooltip.\n\n**Example:**\n\n```php\n$zc-\u003eenableTooltip();\n```\n\n---\n\u003ca id=\"enableValueBox\"\u003e\u003c/a\u003e\n### enableValueBox ( ) `Level 1`\nTurn on chart valueBox.\n\n**Example:**\n\n```php\n$zc-\u003eenableValueBox();\n```\n\n---\n\u003ca id=\"enablePreview\"\u003e\u003c/a\u003e\n### enablePreview ( ) `Level 1`\nTurn on chart preview area.\n\n**Example:**\n\n```php\n$zc-\u003eenablePreview();\n```\n\n---\n\u003ca id=\"disableScaleXZooming\"\u003e\u003c/a\u003e\n### disableScaleXZooming ( ) `Level 1`\nTurn off chart zooming on x-axis.\n\n**Example:**\n\n```php\n$zc-\u003edisableScaleXZooming();\n```\n\n---\n\u003ca id=\"disableScaleYZooming\"\u003e\u003c/a\u003e\n### disableScaleYZooming ( ) `Level 1`\nTurn off chart zooming on y-axis.\n\n**Example:**\n\n```php\n$zc-\u003edisableScaleYZooming();\n```\n\n---\n\u003ca id=\"disableCrosshairX\"\u003e\u003c/a\u003e\n### disableCrosshairX ( ) `Level 1`\nTurn off chart crosshair on x-axis.\n\n**Example:**\n\n```php\n$zc-\u003edisableCrosshairX();\n```\n---\n\u003ca id=\"disableCrosshairY\"\u003e\u003c/a\u003e\n### disableCrosshairY ( ) `Level 1`\nTurn off chart crosshair on y-axis.\n\n**Example:**\n\n```php\n$zc-\u003edisableCrosshairY();\n```\n\n---\n\u003ca id=\"disableTooltip\"\u003e\u003c/a\u003e\n### disableTooltip ( ) `Level 1`\nTurn off chart tooltip.\n\n**Example:**\n\n```php\n$zc-\u003edisableTooltip();\n```\n\n---\n\u003ca id=\"disableValueBox\"\u003e\u003c/a\u003e\n### disableValueBox ( ) `Level 1`\nTurn off chart valueBox.\n\n**Example:**\n\n```php\n$zc-\u003edisableValueBox();\n```\n\n---\n\u003ca id=\"disablePreview\"\u003e\u003c/a\u003e\n### disablePreview ( ) `Level 1`\nTurn off chart preview area.\n\n**Example:**\n\n```php\n$zc-\u003edisablePreview();\n```\n\n---\n\u003ca id=\"getTitle\"\u003e\u003c/a\u003e\n### getTitle ( ) `Level 1`\nGet the chart title.\n\n**Example:**\n\n```php\n$chartTitle = $zc-\u003egetTitle();\n```\n\n---\n\u003ca id=\"getSubtitle\"\u003e\u003c/a\u003e\n### getSubtitle ( ) `Level 1`\nGet the chart subtitle.\n\n**Example:**\n\n```php\n$chartSubtitle = $zc-\u003egetSubtitle();\n```\n\n---\n\u003ca id=\"getLegendTitle\"\u003e\u003c/a\u003e\n### getLegendTitle ( ) `Level 1`\nGet the chart legend title.\n\n**Example:**\n\n```php\n$legendTitle = $zc-\u003egetLegendTitle();\n```\n\n---\n\u003ca id=\"getConfig\"\u003e\u003c/a\u003e\n### getConfig ( ) `Level 1`\nGet the chart JSON configuration.\n\n**Example:**\n\n```php\n$config = $zc-\u003egetConfig();\n```\n\n---\n\u003ca id=\"getScaleXTitle\"\u003e\u003c/a\u003e\n### getScaleXTitle ( ) `Level 1`\nGet the chart x-axis title.\n\n**Example:**\n\n```php\n$xAxisTitle = $zc-\u003egetScaleXTitle();\n```\n\n---\n\u003ca id=\"getScaleYTitle\"\u003e\u003c/a\u003e\n### getScaleYTitle ( ) `Level 1`\nGet the chart y-axis title.\n\n**Example:**\n\n```php\n$yAxisTitle = $zc-\u003egetScaleYTitle();\n```\n\n---\n\u003ca id=\"getScaleXLabels\"\u003e\u003c/a\u003e\n### getScaleXLabels ( ) `Level 1`\nGet the chart x-axis scale values.\n\n**Example:**\n\n```php\n$xAxisLabels = $zc-\u003egetScaleXLabels();\n```\n\n---\n\u003ca id=\"getScaleYLabels\"\u003e\u003c/a\u003e\n### getScaleYLabels ( ) `Level 1`\nGet the cahrt y-axis scale values.\n\n**Example:**\n\n```php\n$yAxisLabels = $zc-\u003egetScaleYLabels();\n```\n\n---\n\u003ca id=\"getSeriesData\"\u003e\u003c/a\u003e\n### getSeriesData ( ) `Level 1`\nGet the chart plot data/values.\n\n**Example:**\n\n```php\n$plotValues = $zc-\u003egetSeriesData();\n```\n\n---\n\u003ca id=\"getSeriesText\"\u003e\u003c/a\u003e\n### getSeriesText ( ) `Level 1`\nGet the chart plot data labels/texts.\n\n**Example:**\n\n```php\n$plotSeriesText = $zc-\u003egetSeriesText();\n```\n\n---\n\u003ca id=\"setConfig\"\u003e\u003c/a\u003e\n### setConfig ( ) `Level 2`\nThis is a single function that accepts a string in the form of dot-syntax. This function allows you to set a value for a single chart property.\n\n**Examples:**\n\n```php\n$zc-\u003esetConfig(\"legend.header.background-color\", \"red\");\n$zc-\u003esetConfig(\"series[1].values\", array(5,9,13,10,22,39));\n```\n\nYou may also pass in an associative array to set multiple attributes from the given root property like this:\n\n```php\n$legendConfig = array(\n    \"header\" =\u003e array(\n        \"background-color\" =\u003e \"red\"\n    ),\n    \"marker\" =\u003e array(\n        \"border-color\" =\u003e \"orange\",\n        \"border-width\" =\u003e \"3px\",\n        \"shadow-angle\" =\u003e \"115\"\n    )\n);\n\n$zc-\u003esetConfig(\"legend\", $legendConfig);\n```\n\nThis syntax is a close-derivative of ZingChart's JSON syntax except that it uses dots to represent sub-object navigation.\n\n---\n\u003ca id=\"trapdoor\"\u003e\u003c/a\u003e\n### trapdoor ( ) `Level 3`\nThis is a single function that accepts a full-blown JSON string. This function allows you to set the entire chart's configuration with a single function call. This JSON string can be generated using standard PHP associative array syntax as well.\n\n### Note: Using the trapdoor will overwrite any previously set chart configurations for that object.\nFor example, if you set `$zc-\u003esetLegendTitle(\"Cool Title\")` and later use `$zc-\u003etrapdoor(\"series\":[{\"values\": [1,2,3]}, {\"values\":[22,23,27]})` then the legend title will be destroyed.\n\n**Examples:**\n\n```php\n$myConfig = array(\n    \"legend\" =\u003e array(\n        \"header\" =\u003e array(\n            \"background-color\" =\u003e \"red\"\n        ),\n        \"marker\" =\u003e array(\n            \"border-color\" =\u003e \"orange\",\n            \"border-width\" =\u003e \"3px\",\n            \"shadow-angle\" =\u003e \"115\"\n        )\n    ),\n    \"series\" =\u003e array(\n        array(\n            \"values\" =\u003e array(33,45,27,32,15),\n            \"text\"   =\u003e \"Apples\"\n        ),\n        array(\n            \"values\" =\u003e array(1,5,9,3,7),\n            \"text\"   =\u003e \"Oranges\"\n        )\n    )\n);\n$zc-\u003etrapdoor(json_encode($myConfig));\n```\nOr you could pass in the JSON string like this:\n\n```php\n$jsonString = \u003c\u003c\u003c EOT\n{\n    \"legend\":{\n        \"header\":{\n            \"background-color\":\"red\"\n        },\n        \"marker\":{\n            \"border-color\":\"orange\",\n            \"border-width\":\"3px\",\n            \"shadow-angle\":\"115\"\n        }\n    },\n    \"series\":[\n    {\n        \"values\":[33,45,27,32,15],\n        \"text\":\"Apples\"\n    },\n    {\n        \"values\":[1,5,9,3,7],\n        \"text\":\"Oranges\"\n    }]\n}\nEOT;\n\n$zc-\u003etrapdoor($jsonString);\n```\nOne thing to note here is that if you are using the array method, then you must prepend your array with `json_encode(...)` in order to render the chart properly when you call the render method.\n\nFinished product:  \nThe following three lines of code will produce an area chart that is 600x400 pixels with the light color theme rendered in the html element's id of 'myChart'.\n\n```php\n$zc = new ZC(\"myChart\", \"area\", \"light\", 600, 400);\n$zc-\u003etrapdoor(json_encode($myConfig));\n$zc-\u003erender();\n```\n\n## More Documentation\n\nYou may visit our [JSON Attributes](https://www.zingchart.com/docs/json-attributes-syntax/) page for more in-depth tutorials on how to use JSON syntax with ZingChart should you need it.\n\n## Live Demo\n\n[Dashboard](https://examples.zingchart.com/dashboards/php)\n\n## Issues, Contributions, or Requests\n\nFeature(s) missing? Something broken?   \nPost your questions, comments, and issues right here in this GitHub repository. We welcome any input you may have and will happily respond promptly. And feel free to fork this repo to append any additional features you like.\n\nThank you for reading this tutorial.  \nHappy PHP Charting with ZingChart\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzingchart%2Fzingchart-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzingchart%2Fzingchart-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzingchart%2Fzingchart-php/lists"}