Count All Lemmata - warwickfoster/qurantools GitHub Wiki
app/charts/chart_formula_distribution.php
File:Purpose
The provided code snippet is a PHP script that generates a chart that displays the distribution of formulae involving a specific root across different Surahs in the Quran.
Key Features
- Formula Filtering The script allows users to filter formulae based on root, length, and type.
- Provenance Control Users can choose to display formulae from all Suras, Meccan Suras, or Medinan Suras.
- Chart Display The script uses the Google Charts API to generate a bar chart that visualizes the distribution of formulae.
- Responsive Design The chart resizes responsively to different screen sizes.
Key Variables
FORMULA
: The root of the formulae to be displayed.FORMULA_LENGTH
: The length of the formulae.FORMULA_TYPE
: The type of formulae.ROOT
: The root of the formulae.PROV
: The provenance filter (ANY, MECCAN, or MEDINAN).
Code Breakdown
- The script sets up chart control selectors for provenance filtering.
- It generates the chart container with a specific size for mini mode or the default size otherwise.
- The chart is displayed using the Google Charts API with the following options:
- Data source containing the distribution data.
- Chart type as a bar chart.
- Chart title and labels.
- Chart width and height.
- The script includes the footer if it is not a mini mode display.
Usage
To use the script, the user needs to specify the FORMULA
, FORMULA_LENGTH
, FORMULA_TYPE
, and ROOT
parameters in the URL. The script will then generate the chart based on these parameters.
Additional Notes
- The script requires a Google API key for the Google Charts API.
- The data source for the chart is not included in the provided code snippet.
- The script can be customized to include additional chart options and features.