Export Full Gloss List - warwickfoster/qurantools GitHub Wiki

File: app/charts/chart_verse_lengths.php

Purpose

The provided code snippet is a PHP script that generates a chart of verse lengths for a specific sura in the Quran. It uses the FusionCharts library to create a column chart that displays the number of words in each verse.

Features

  • Suras can be selected using a GET parameter S.
  • The chart can be sorted by number of words using the SORT parameter.
  • There is an option to view the chart in both normal and mini mode.
  • The chart includes a legend and hover tooltips.

Functionality

  • The script connects to the database and retrieves the verse lengths for the selected sura.
  • It generates a JSON data source for the FusionCharts library, which is then used to create the chart.
  • The chart is rendered within a div element with the ID chartContainer.
  • The navigation controls allow users to sort the chart and switch between normal and mini mode.

Usage

To use the script, simply include the following files in your web page:

  • config.php
  • functions.php
  • auth.php
  • standard_header.php
  • chart_verse_lengths.php

Example

To view the chart for Sura 1, users can navigate to the following URL:

/charts/chart_verse_lengths.php?S=1

Additional Notes

  • The script assumes that the database table QURAN-DATA contains the necessary data.
  • The segment column is used to determine the beginning of each verse.
  • The theme property in the JSON data source can be changed to customize the chart theme.