Charrty, previously Chartinator, is a jQuery plugin that turns HTML tables, Google Sheets information, and JavaScript arrays into Google Charts.
It helps responsive chart sizing, table-to-chart conversion, information transformation, annotations, tooltips, and Google Chart occasion handlers.
Options
- HTML tables, Google Sheets, and JavaScript arrays as chart information sources.
- Bar, column, pie, line, space, geo, calendar, desk, and different Google Chart sorts.
- Responsive resizing and configurable chart facet ratios.
- Row and column filtering plus information transposition.
- Customized tooltip and annotation textual content from desk or sheet information.
- Elective HTML desk technology from array or Google Sheets information.
- Chart zoom and X/Y offsets for chart framing.
- Google Chart occasion handlers by way of the
chartEventspossibility.
Find out how to use it
1. Load jQuery and Charrty
Load jQuery first, then embrace charrty.js or charrty.min.js.
<script src="path/to/jquery.min.js"></script> <script src="dist/js/charrty.min.js"></script>
2. Create a chart from an HTML desk
Place column definitions within the first row. Charrty reads data-type values resembling string, quantity, boolean, date, datetime, and timeofday. Use data-role="tooltip" or data-role="annotation" for Google Charts function columns.
<desk id="salesTable">
<caption>Quarterly Gross sales</caption>
<tr>
<th scope="col" data-type="string">Quarter</th>
<th scope="col" data-type="quantity">Gross sales</th>
<th scope="col" data-role="tooltip">Particulars</th>
</tr>
<tr>
<td>Q1</td>
<td>128</td>
<td>Q1 gross sales: 128</td>
</tr>
<tr>
<td>Q2</td>
<td>164</td>
<td>Q2 gross sales: 164</td>
</tr>
<tr>
<td>Q3</td>
<td>151</td>
<td>Q3 gross sales: 151</td>
</tr>
</desk>
Apply .charrty() to the desk. Charrty creates the chart container after the desk when the chosen component incorporates desk information.
$('#salesTable').charrty({
chartType: 'ColumnChart',
showTable: 'present',
columnChart: {
title: 'Quarterly Gross sales',
legend: {
place: 'none'
}
}
});
3. Use a separate chart container
Set tableSel when the chart and supply desk use separate parts.
<div id="salesChart"></div> <desk id="salesData"> ... </desk>
$('#salesChart').charrty({
tableSel: '#salesData',
chartType: 'BarChart',
showTable: 'disguise',
barChart: {
title: 'Gross sales by Quarter'
}
});
4. Create a chart from JavaScript arrays
The columns possibility defines Google Charts column metadata. The rows possibility provides the info rows.
<div id="trafficChart"></div>
$('#trafficChart').charrty({
columns: [
{ label: 'Month', type: 'string' },
{ label: 'Visits', type: 'number' }
],
rows: [
['January', 1840],
['February', 2210],
['March', 2475]
],
chartType: 'LineChart',
lineChart: {
title: 'Month-to-month Visits'
}
});
5. Use Google Sheets information
Charrty accepts a public Google Sheet key by way of googleSheetKey. The plugin fetches the sheet as CSV earlier than it builds the chart.
<div id="sheetChart"></div>
$('#sheetChart').charrty({
googleSheetKey: 'YOUR_PUBLIC_SHEET_KEY',
chartType: 'PieChart',
pieChart: {
title: 'Site visitors Sources'
}
});
Google Sheets compatibility: Charrty at the moment requests the older spreadsheets.google.com/spreadsheet/pub?key=...&output=csv endpoint. Google Charts now paperwork the /gviz/tq question endpoint for spreadsheet information and requires authorization for personal sheets. Take a look at the googleSheetKey workflow along with your sheet earlier than utilizing it in a manufacturing venture.
6. Add Google Chart occasion handlers
Go Google Visualization occasion names and handler capabilities by way of chartEvents. Accessible occasion names rely on the chosen Google Chart sort.
$('#interactiveChart').charrty({
columns: [
{ label: 'Category', type: 'string' },
{ label: 'Value', type: 'number' }
],
rows: [
['Alpha', 42],
['Beta', 31],
['Gamma', 27]
],
chartType: 'PieChart',
chartEvents: [
{
event: 'select',
handler: function () {
console.log('Chart selection changed');
}
}
]
});
Charrty Choices
Information Supply and Transformation Choices
| Choice | Description |
|---|---|
googleSheetKey |
Google Sheet key utilized by the built-in CSV request. Default: false. |
columns |
Array of Google Charts column definitions. Default: false. |
rows |
Array of information rows. Default: false. |
colIndexes |
Column indexes the place array information ought to be inserted into desk or sheet information. Default: false. |
tableSel |
jQuery selector for the HTML desk used as the info supply. Default: false. |
dataTitle |
Title for the info set and generated desk caption. Default: false. |
createTable |
Creates a desk from chart information. Values: false, basic-table, or table-chart. Default: false. |
ignoreRow |
Array of row indexes to exclude from HTML desk or Google Sheets information. Default: []. |
ignoreCol |
Array of column indexes to exclude from HTML desk or Google Sheets information. Default: []. |
transpose |
Swaps rows and columns for desk or sheet information. Default: false. |
tooltipConcat |
Template string for customized tooltip textual content. Helps area, information, and label key phrases. Default: false. |
annotationConcat |
Template string for customized annotation textual content. Helps area, information, and label key phrases. Default: false. |
Chart Setup and Rendering Choices
| Choice | Description |
|---|---|
urlJSAPI |
URL that Charrty hundreds earlier than it calls the Google Charts loader API. Default: https://www.google.com/jsapi. |
chartType |
Google Visualization constructor title, resembling BarChart, PieChart, ColumnChart, Calendar, GeoChart, or Desk. Default: BarChart. |
chartId |
ID for the chart container. Charrty creates a random ID when no ID is equipped. |
chartClass |
Class utilized to the chart container. Default: chtr-chart. |
tableId |
ID for the supply or generated desk. Charrty creates a random ID when no ID is equipped. |
tableClass |
Class utilized to the supply or generated desk. Default: chtr-table. |
chartAspectRatio |
Width-to-height ratio used for responsive chart dimensions. Default: false. |
chartZoom |
CSS remodel scale utilized to the chart canvas. Default: 0. |
chartOffset |
Array with X and Y proportion offsets for chart framing. Default: false. |
chartEvents |
Array of objects with occasion and handler properties for Google Chart occasions. Default: false. |
chartOptions |
Generic Google Chart choices object. Charrty makes use of it when current and in any other case checks the chart-specific possibility object. |
Chart-specific Choice Objects
| Choice | Description |
|---|---|
barChart |
Google Bar Chart choices plus Charrty defaults for font, chart space, and legend. |
pieChart |
Google Pie Chart choices plus Charrty defaults for font and chart space. |
columnChart |
Google Column Chart choices plus Charrty defaults for font, chart space, and legend. |
lineChart |
Google Line Chart choices plus Charrty defaults for font, chart space, and legend. |
areaChart |
Google Space Chart choices plus Charrty defaults for font, chart space, and legend. |
geoChart |
GeoChart choices. Charrty additionally helps a customized title tag by way of titleTextStyle.tag. |
calendar |
Calendar choices plus Charrty settings for cell scaling, title textual content, month labels, day labels, and tooltip textual content. |
desk |
Desk Chart choices plus Charrty settings for font, formatter, HTML cells, and CSS class names. |
Desk and Chart Visibility Choices
| Choice | Description |
|---|---|
showTable |
Controls the HTML desk after the chart hundreds. Values: present, disguise, or take away. Default: disguise. |
showTableCSS |
CSS object utilized when Charrty reveals the desk. |
hideTableCSS |
CSS object utilized when Charrty hides the desk. |
showChartCSS |
CSS object utilized when Charrty reveals the chart. |
hideChartCSS |
CSS object utilized when Charrty hides the chart. Default opacity: 0. |
Google Charts Loader Compatibility
Charrty at the moment hundreds https://www.google.com/jsapi after which calls google.load('visualization', '1', ...). Google Charts now makes use of https://www.gstatic.com/charts/loader.js with google.charts.load(). Altering solely urlJSAPI doesn’t replace Charrty’s loader name, because the plugin code calls google.load() after the script hundreds.
Alternate options and Associated Assets
Changelog
2026-08-25
- Undertaking renamed from Chartinator to Charrty. The plugin methodology modified to
.charrty(), and the JavaScript information modified tocharrty.jsandcharrty.min.js.
2015-06-16
2015-05-08
2015-04-14
2015-03-25
This superior jQuery plugin is developed by jbowyers. For extra Superior Usages, please examine the demo web page or go to the official web site.

