Dictionary - warwickfoster/qurantools GitHub Wiki
app/charts/chart_root_usage.php
File:Purpose
The code you provided is a PHP script that generates a chart displaying root usage in the Quran. It allows users to filter the data by provenance (Meccan, Medinan, all suras), count type (all occurrences, occurrences per 100 words), and sort order.
Key Features
- Chart Type Bar chart
- Data Source Quranic text
- Filters
- Provenance (Meccan, Medinan, all suras)
- Count type (all occurrences, occurrences per 100 words)
- Sort order (Sura number, value)
- Navigation
- Expander link for switching to mini mode
- Chart controls for filtering and sorting
- Output HTML and JavaScript code for rendering the chart
Code Structure
The script consists of several sections:
- Header Includes necessary CSS and JavaScript files.
- Body
- Navigation and title bar
- Chart container
- Chart controls for filtering and sorting
- Chart rendering code
- Footer
Data Retrieval
The script retrieves Quranic text and root usage data based on the selected filters. The data is stored in variables such as $PROV
, $COUNT
, $TYPE
, and $SORT
.
Chart Configuration
The chart is created using JavaScript and the Chart.js
library. The chart data is passed as an array of objects, where each object represents a bar in the chart.
User Interaction
The user can interact with the chart controls to filter and sort the data. The script updates the chart data and navigation links accordingly.
Additional Features
- The script includes a provenance footer that provides information about the data source.
- A print control is available for users to print the chart.
Conclusion
The PHP script you provided is a comprehensive solution for generating a Quranic root usage chart with filtering and navigation capabilities. It provides a user-friendly interface for exploring root usage patterns in the Quran.