-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathREADME.html
More file actions
943 lines (783 loc) · 40.7 KB
/
README.html
File metadata and controls
943 lines (783 loc) · 40.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
<h1 id="about-chartinator">About Chartinator</h1>
<p><strong>Chartinator</strong> - Google Charts made easier and accessible.</p>
<ul>
<li><strong>Description</strong>: A jQuery plugin for transforming HTML tables, Google Sheets and js arrays into charts using Google Charts</li>
<li><strong>Repository</strong>: <a href="https://github.com/jbowyers/chartinator">https://github.com/jbowyers/chartinator</a></li>
<li><strong>Demo</strong>: <a href="http://chartinator.com">http://chartinator.com</a></li>
<li><strong>Bower</strong>: chartinator</li>
<li><strong>Requires</strong>: jQuery, Google Charts</li>
<li><strong>Author</strong>: jbowyers</li>
<li><strong>Copyright</strong>: 2015 jbowyers</li>
<li><strong>License</strong>: GPLv3</li>
<li><strong>Version: 0.3.10</strong></li>
</ul>
<h2 id="demo">Demo</h2>
<p>Visit <a href="http://chartinator.com">http://chartinator.com</a> to view a demo</p>
<h3 id="what-is-this-repository-for-">What is this repository for?</h3>
<p>Transforming HTML tables, Google Sheets and js arrays into charts using Google Chart ( <a href="https://developers.google.com/chart/">https://developers.google.com/chart/</a> ).</p>
<h3 id="what-are-the-current-features-">What are the current features?</h3>
<p>Chartinator currently supports the following:</p>
<ul>
<li>Creation of all chart types using Google Charts - Visit <a href="https://developers.google.com/chart/interactive/docs/gallery">https://developers.google.com/chart/interactive/docs/gallery</a></li>
<li>Extraction of data from HTML tables, Google spreadsheets, and JavaScript arrays</li>
<li>Accessible data - Using HTML tables as data sources makes data accessible to screen readers and searchbots</li>
<li>Generation of HTML tables from other data sources - Makes data extracted from JS arrays and Google Sheets accessible</li>
<li>Showing and hiding of HTML tables accessibly</li>
<li>Manipulation of data extracted from HTML tables and Google Sheets using JavaScript arrays</li>
<li>Transposition of data - swapping of rows and columns</li>
<li>Resizing of charts on screen resize - Responsive Web Design</li>
<li>Chart aspect ratio control</li>
<li>Art direction - Zoom and offset of chart - Useful for refining the region displayed in geoCharts</li>
<li>Customization of chart tooltips and annotations</li>
<li>Customization of all Google Chart options - Fonts, colors, chart formatting, etc.</li>
<li>Adding Google Chart event handlers - Event handlers can be defined in the options</li>
</ul>
<h3 id="how-do-i-get-set-up-">How do I get set up?</h3>
<ul>
<li><strong>Download</strong> - Download and extract the Chartinator zip files - <a href="https://github.com/jbowyers/chartinator">https://github.com/jbowyers/chartinator</a></li>
<li><strong>Copy files</strong> - Copy the chartinator.js file to your project</li>
<li><strong>Setup the HTML</strong> - Open the chartinator.html sample file and copy and paste the desired html into the
files in your project. Or, adapt your existing project files to work with chartinator (see Configuration).</li>
<li><strong>Link to chartinator.js</strong> - Add a script references in your HTML files</li>
<li><strong>Initialize Chartinator</strong> - Activate the plugin using jQuery (see Configuration)</li>
</ul>
<h3 id="using-bower-package-manager">Using Bower Package Manager</h3>
<p>The Chartinator repo is registered as a bower package as 'chartinator'.</p>
<h2 id="configuration">Configuration</h2>
<p>The Chartinator repo includes the chartinator.js plugin file as well as sample HTML.
To use the plugin you need to: </p>
<ul>
<li>Reference the chartinator.js file in your html</li>
<li>add/modify your HTML tables, Google Sheets or js arrays </li>
<li>Use jQuery to modify options</li>
</ul>
<h3 id="using-data-from-html-tables">Using Data from HTML Tables</h3>
<p>Chartinator is designed to extract data from HTML tables.
The header cells (th elements) in HTML table must be in the first row (or first column if transposing table)
and should have a 'data-type' attribute with one of the following values:</p>
<ul>
<li>'string' </li>
<li>'number' </li>
<li>'boolean' </li>
<li>'date' </li>
<li>'datetime' </li>
<li>'timeofday' </li>
</ul>
<p>or a 'data-role' attribute with one of the following values:</p>
<ul>
<li>'tooltip'</li>
<li>'annotation'</li>
</ul>
<p>The caption element's text will be used as a title for the chart by default</p>
<p>You can also restructure the data extracted from an HTML table by adding and replace data with data contained in js data arrays.
For example you can add column headers, columns of data and rows of data. You can also remove and replace headers
and columns and transpose data.</p>
<h4 id="sample-html">Sample HTML</h4>
<pre><code class="lang-html">
<div id="chart_canvas"></div>
<table id="chart_data">
<caption>Chart Title</caption>
<tr>
<th scope="col" data-type="string">Domain Axis Name</th>
<th scope="col" data-type="number">Data Axis Name</th>
<th scope="col" data-role="tooltip">Tooltip</th>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
<td>Tooltip text</td>
</tr> ...</code></pre>
<h3 id="using-data-from-google-sheets">Using Data from Google Sheets</h3>
<p>You can also use data from Google Sheets to define chart data.
Data extracted from a Google Sheet can be added to and replaced with data contained in js data arrays.
For example you can add column headers, columns of data and rows of data. You can also remove and replace headers
and columns and transpose data.</p>
<p>To use a Google Sheet as a data source you need to do the following:</p>
<ul>
<li>Create the Google Sheet (visit: <a href="https://docs.google.com/spreadsheets">https://docs.google.com/spreadsheets</a>)</li>
<li>Make sure your sheet is the only sheet in the Google Sheets document</li>
<li>Make the sheet public - Choose 'Publish to the Web' from the 'File' menu</li>
<li>Get the key id from the link url - Should look something like: '1kg6f4UVJPpT45D7ucAE8lhsVp8vIUl7bSMM442_DrhI'</li>
<li>Set the 'googleSheetKey' option in the jQuery Chartinator options to be the key id</li>
</ul>
<p>Note: Data is extracted from a Google Sheet as comma separated values (csv) so don't use commas in data</p>
<h3 id="using-data-from-javascript-arrays">Using Data from JavaScript Arrays</h3>
<p>You can also use data from JavaScript arrays you create to completely define the chart data
or to add to and replace data extracted from an HTML table or Google Sheet, including the column headers.</p>
<p>The JS data arrays must adhere to the following syntax:</p>
<pre><code class="lang-javascript">
// Columns - The columns data-array
columns: [
{label: 'Primary Column Title', type: 'string'},
{label: 'Data Column Title', type: 'number'},
{role: 'tooltip', type: 'string'}],
// Rows - The rows data-array
rows: [
['China', 18, '2015 - 18'],
['Japan', 12, '2015 - 12'],
['Russia', 10, '2015 - 10'],
['Mexico', 5, '2015 - 5'],
['Brazil', 6, '2015 - 6'],
['Italy', 4, '2015 - 4']],</code></pre>
<p>See <a href="https://developers.google.com/chart/interactive/docs/datatables_dataviews#arraytodatatable">https://developers.google.com/chart/interactive/docs/datatables_dataviews#arraytodatatable</a> for more info.</p>
<h3 id="sample-jquery">Sample jQuery</h3>
<p>The Chart must be initialized using jQuery.</p>
<pre><code class="lang-javascript">
<script src="js/chartinator.js" ></script>
<script>
jQuery(function ($) {
// Bar Chart Example
// Use any jQuery selector to select the chart canvas(es)
var chart1 = $('#barChart').chartinator({
// Custom Options ------------------------------------------------------
// The Google Sheet key
// The id of the Google sheet taken from the public url of the Sheet
// Default: false
googleSheetKey: '1kg6f4UVJPpT45D7ucAE8lhsVp8vIUl7bSMM442_DrhI',
// The data columns js array
// An array of object literals that define each column
// Default: false
//columns: [
// {label: 'Country', type: 'string'},
// {label: 'Students', type: 'number'},
// {role: 'tooltip', type: 'string'}],
// Column indexes array - An array of column indexes defining where
// the data will be inserted into any existing data extracted
// from an HTML table or Google Sheet
// Default: false - js data array columns replace any existing columns
// Note: when inserting more than one column be sure to
// increment index number to account for previously inserted indexes
//colIndexes: [2],
// Rows - The rows data-array
// If colIndexes array has values the row data will be inserted
// into the columns defined in the colindexes array. Otherwise
// the row data will be appended to any existing row data extracted
// from an HTML table or Google Sheet
// Default: false
//rows: [
// ['China', 18, '2013 - 18'],
// ['Japan', 12, '2013 - 12'],
// ['Russia', 10, '2013 - 10']],
// The jQuery selector of the HTML table to extract the data from.
// Default: false - Checks if the element this plugin
// is applied to is an HTML table
//tableSel: '.barChart',
// Ignore row indexes array - An array of row index numbers to ignore
// Default: []
// Note: Only works on data extracted from HTML tables or Google Sheets
// The headings row is index 0
//ignoreRow: [6,8],
// Ignore column indexes array - An array of column indexes to ignore
// Default: []
// Note: Only works when extracting data from HTML tables or Google Sheets
//ignoreCol: [2],
// Transpose data Boolean - swap columns and rows
// Default: false
// Note: Only works on data extracted from HTML tables or Google Sheets
//transpose: false,
// The chart type - String
// Derived from the Google Charts visualization class name
// Default: 'BarChart'
// Use TitleCase names. eg. BarChart, PieChart, ColumnChart, Calendar, GeoChart, Table.
// See Google Charts Gallery for a complete list of Chart types
// https://developers.google.com/chart/interactive/docs/gallery
chartType: 'BarChart',
// The annotation concatenation
// Defines a string for concatenating a custom annotation.
// Keywords: 'domain', 'data', 'label'
// The keywords will be replaced with current values
// 'domain': the primary axis value,
// 'data': the data value,
// 'label': the column title
// Default: false - use Google Charts annotation defaults
// Note: Only works when extracting data from HTML tables or Google Sheets.
// Not supported on pie, geo, calendar charts
annotationConcat: 'domain - label: data',
// The chart aspect ratio custom option - width/height
// Used to calculate the chart dimensions relative to the width or height
// this is overridden if the Google Chart's height and width options have values
// Suggested value: 1.25
// Default: false - not used
chartAspectRatio: 1.25,
// Google Bar Chart Options
barChart: {
// Width of chart in pixels - Number
// Default: automatic (unspecified)
width: null,
// Height of chart in pixels - Number
// Default: automatic (unspecified)
//height: 400,
chartArea: {
left: "20%",
top: 40,
width: "74%",
height: "80%"
},
// The font size in pixels - Number
// Default: false - Use Google Charts defaults
fontSize: 14,
// Font-family name - String
// Default: The body font-family
fontName: 'Roboto',
// Chart Title - String
// Default: Table caption.
title: 'Bar Chart Sample',
titleTextStyle: {
// The font size in pixels - Number
// Or use css selectors as keywords to assign font sizes from the page
// For example: 'body'
// Default: false - Use Google Charts defaults
fontSize: 20
},
legend: {
// Legend position - String
// Options: bottom, top, left, right, in, none.
// Default: 'bottom'
position: 'bottom'
},
// Array of colours
colors: ['#3691ff'],
// Stack values within a bar or column chart - Boolean
// Default: false.
isStacked: false,
tooltip: {
// Shows tooltip with values on hover - String
// Options: focus, none.
// Default: focus
trigger: 'focus'
}
},
// Show table as well as chart - String
// Options: 'show', 'hide', 'remove'
showTable: 'show'
});
});
</script></code></pre>
<h3 id="list-of-options">List of Options</h3>
<p>The following is a list of useful options with default values. For more information about Google Chart options visit
<a href="https://developers.google.com/chart/">https://developers.google.com/chart/</a></p>
<h4 id="all-chart-types-options">All chart types options</h4>
<p>The following are options that are specific to Chartinator and apply to all chart types unless otherwise specified.</p>
<pre><code class="lang-javascript">
// URL - The path to the Google AJAX API. Default: 'https://www.google.com/jsapi'
urlJSAPI: 'https://www.google.com/jsapi',
// The Google Sheet key
// The id code of the Google sheet taken from the public url of your Google Sheet
// Default: false
googleSheetKey: false,
// The data columns js array
// An array of object literals that define each column
// Default: false
columns: false,
// Column indexes array - An array of column indexes defining where
// the data will be inserted into any existing data extracted from an
// HTML table or Google Sheet
// Default: false - js data array columns replace any existing columns
// Note: when inserting more than one column be sure to increment index number
// to account for previously inserted indexes
colIndexes: false,
// Rows - The rows data-array
// If colIndexes array has values the row data will be inserted into the columns
// defined in the colindexes array. Otherwise the row data will be appended
// to any existing row data extracted from an HTML table or Google Sheet
// Default: false
rows: false,
// The jQuery selector of the HTML table element to extract the data from.
// Default: false - Checks if the element this plugin is applied to is an HTML table
tableSel: false,
// The data title
// A title used to identify the set of data
// Used as a caption when generating an HTML table
dataTitle: false,
// Create Table - String
// Create a basic HTML table or a Google Table Chart from chart data
// Options: false, 'basic-table', 'table-chart'
// Note: This table will replace an existing HTML table
createTable: false,
// Ignore row indexes array - An array of row index numbers to ignore
// Default: []
// Note: Only works on data extracted from HTML tables or Google Sheets
// The headings row is index 0
ignoreRow: [],
// Ignore column indexes array
// An array of column indexes to ignore in the HTML table or Google Sheet
// Default: []
// Note: Only works on data extracted from HTML tables or Google Sheets
ignoreCol: [],
// Transpose data Boolean - swap columns and rows
// Default: false
// Note: Only works on data extracted from HTML tables or Google Sheets
transpose: false,
// The tooltip concatenation - Defines a string for concatenating a custom tooltip.
// Keywords: 'domain', 'data', 'label' - these will be replaced with current values
// 'domain': the primary axis value, 'data': the data value, 'label': the column title
// Default: false - use Google Charts tooltip defaults
// Note: Only works when extracting data from HTML tables or Google Sheets
// Not supported on pie, calendar charts
tooltipConcat: false,
// The annotation concatenation - Defines a string for concatenating a custom annotation.
// Keywords: 'domain', 'data', 'label' - these will be replaced with current values
// 'domain': the primary axis value, 'data': the data value, 'label': the column title
// Default: false - use Google Charts annotation defaults
// Note: Only works when extracting data from HTML tables or Google Sheets.
// Not supported on pie, geo, calendar charts
annotationConcat: false,
// The chart type - String
// Derived from the Google Charts visualization class name
// Default: 'BarChart'
// Use TitleCase names. eg. BarChart, PieChart, ColumnChart, Calendar, GeoChart, Table.
// See Google Charts Gallery for a complete list of Chart types
// https://developers.google.com/chart/interactive/docs/gallery
chartType: 'BarChart',
// Chart Id - The id applied to the chart container element as an id and a class
// This is overridden if the chart element has an id or the id is user defined
chartId: 'c24_' + Math.random().toString(36).substr(2, 9),
// The class to apply to the dynamically created chart container element
chartClass: 'chtr-chart',
// Table Id - The id applied to the table element as an id and a class
// This is overridden if the table element has an id or is user defined
tableId: 'c24_table_' + Math.random().toString(36).substr(2, 9),
// The class to apply to the table element
tableClass: 'chtr-table',
// The chart aspect ratio custom option - width/height
// Used to calculate the chart dimensions relative to the width or height
// this is overridden if the Google Chart's height and width options have values
// Default: false - not used
chartAspectRatio: false,
// The chart zoom factor - number
// A scaling factor for the chart - uses CSS3 transform
// To prevent tooltips from displaying off canvas when zooming, set tooltip.isHtml: true
// Default: 0
chartZoom: 0,
// The chart offset - Array of numbers
// An array of x and y offset percentage values
// Used to offset the chart by percentages of the height and width - uses CSS3 transform
// To prevent tooltips from displaying off canvas when offsetting, set tooltip.isHtml: true
// Default: false
chartOffset: false,
// The chart event objects array
// An array of objects containing Google Chart event types and handlers
// Each object must contain an 'event' and a 'handler' name value pair
// Example: [{ 'event': 'select', 'handler': function (e) { ... }}]
// Default: false
chartEvents: false,
// The Google Chart Options
// This option can be used with any chart type
// Some chart types have default options defined within Chartinator by the following objects:
// barChart, pieChart, columnChart, calendar, table, areaChart, lineChart
// These objects should be used instead of this one when using those chart types
// Default: no default - not defined
chartOptions: {},
// Google Bar Chart Options - Object Literal
// This should be used instead of the chartOptions object when creating a bar chart
//barChart: {},
// Google Pie Chart Options - Object Literal
// This should be used instead of the chartOptions object when creating a pie chart
//pieChart: {},
// Google Column Chart Options - Object Literal
// This should be used instead of the chartOptions object when creating a column chart
//columnChart: {},
// Google Line Chart Options - Object Literal
// This should be used instead of the chartOptions object when creating a line chart
//lineChart: {},
// Google Area Chart Options - Object Literal
// This should be used instead of the chartOptions object when creating a area chart
//areaChart: {},
// Google Geo Chart Options - Object Literal
// This should be used instead of the chartOptions object when creating a area chart
//geoChart: {},
// Google Calendar Chart Options - Object Literal
// This should be used instead of the chartOptions object when creating a calendar chart
//calendar: {},
// Google Table Chart Options - Object Literal
// This should be used instead of the chartOptions object when creating a table chart
//table: {},
// Show table along with chart - String
// Options: 'show', 'hide', 'remove'. Default: 'hide'
showTable: 'hide',
// The CSS literal used to show the table.
showTableCSS: { 'position': 'static', 'top': 0 },
// The CSS literal used to hide the table.
hideTableCSS: { 'position': 'absolute', 'top': '-9999px', 'width': $tableS.width() },
// The CSS literal used to show the chart.
showChartCSS: { },
// The CSS literal used to hide the chart.
hideChartCSS: { 'opacity': 0}</code></pre>
<h4 id="google-bar-chart-options">Google Bar Chart Options</h4>
<p>The following are some of the Google Charts Bar Chart options, unless otherwise specified.</p>
<pre><code class="lang-javascript">
// Google Bar Chart Options - Object Literal
barChart: {
// Width of chart in pixels - Number
// Default: automatic (unspecified)
width: null,
// Height of chart in pixels - Number
// Default: automatic (unspecified)
height: 200,
chartArea: {
left: "20%",
top: 40,
width: "75%",
height: "85%"
},
// The font size in pixels - Number
// Or use css selectors as keywords to assign font sizes from the page
// For example: 'body'
// Default: false - Use Google Charts defaults
fontSize: 'body',
// Font-family name - String
// Default: The body font-family
fontName: 'Arial',
// Chart Title - String
// Default: Table caption.
title: 'Bar Chart Sample',
titleTextStyle: {
// The font size in pixels - Number
// Or use css selectors as keywords to assign font sizes from the page
// For example: 'body'
// Default: Google Charts defaults
fontSize: 'h3',
},
legend: {
// Legend position - String
// Options: bottom, top, left, right, in, none.
// Default: 'bottom'
position: 'right'
},
// Array of colours
colors: ['#3691ff'],
// Stack values within a bar or column chart - Boolean
// Default: false.
isStacked: false,
tooltip: {
// Shows tooltip with values on hover - String
// Options: focus, none.
// Default: focus
trigger: 'focus'
}
},</code></pre>
<p>For a complete list of Bar chart options visit
<a href="https://developers.google.com/chart/interactive/docs/gallery/barchart#Configuration_Options">Google Bar Charts</a></p>
<h4 id="google-pie-chart-options">Google Pie Chart Options</h4>
<p>The following are some of the Google Charts Pie Chart options, unless otherwise specified.</p>
<pre><code class="lang-javascript">
// Google Pie Chart Options
pieChart: {
// Width of chart in pixels - Number
// Default: automatic (unspecified)
width: null,
// Height of chart in pixels - Number
// Default: automatic (unspecified)
height: 200,
chartArea: { // The chart proportions
left: "20%",
top: 40,
width: "60%",
height: "85%"
},
// The font size in pixels - Number
// Or use css selectors as keywords to assign font sizes from the page
// For example: 'body'
// Default: false - Use Google Charts defaults
fontSize: 'body',
// The font family name. String
// Default: body font family
fontName: 'Arial',
// Chart Title. String
// Default: The table caption text.
title: 'Chart Title',
titleTextStyle: {
// The font size in pixels - Number
// Or use css selectors as keywords to assign font sizes from the page
// For example: 'body'
// Default: false - Use Google Charts defaults
fontSize: 'h3',
},
legend: {
// Legend position - Controls display of legend. String
// Options: 'bottom', 'top', 'left', 'right', 'in', 'none'.
position: 'right'
},
// Array of colours
colors: ['#90A046', '#90A046'],
// Makes chart 3D. Boolean, Default: false.
is3D: false,
tooltip: {
// String - Shows tooltip with values on hover.
// Options: 'focus', 'none'. Default: focus
trigger: 'focus',
}
},</code></pre>
<p>For a complete list of Pie Chart options visit
<a href="https://developers.google.com/chart/interactive/docs/gallery/piechart#Configuration_Options">Google Pie Charts</a></p>
<h4 id="google-column-chart-options">Google Column Chart Options</h4>
<p>The following are some of the Google Charts Column Chart options, unless otherwise specified.</p>
<pre><code class="lang-javascript">
// Google Column Chart Options
columnChart: {
// Width of chart in pixels - Number
// Default: automatic (unspecified)
width: null,
// Height of chart in pixels - Number
// Default: automatic (unspecified)
height: 200,
chartArea: { // The chart proportions
left: "20%",
top: 40,
width: "60%",
height: "85%"
},
// The font size in pixels - Number
// Or use css selectors as keywords to assign font sizes from the page
// For example: 'body'
// Default: false - Use Google Charts defaults
fontSize: 'body',
// The font family name - String
// Default: body font family
fontName: 'Arial',
// Chart Title - String
// Default: The table caption text.
title: 'Chart Title',
titleTextStyle: {
// The font size in pixels - Number
// Or use css selectors as keywords to assign font sizes from the page
// For example: 'body'
// Default: false - Use Google Charts defaults
fontSize: 'h3',
},
legend: {
// Legend position - Controls display of legend. String
// Options: 'bottom', 'top', 'left', 'right', 'in', 'none'.
Default: 'bottom'
position: 'right'
},
// Array of colours
colors: ['#90A046', '#90A046'],
// Stack values within a bar or column chart. Boolean, Default: false.
isStacked: false,
tooltip: {
// String - Shows tooltip with values on hover.
// Options: 'focus', 'none'. Default: focus
trigger: 'focus',
}
},</code></pre>
<p>For a complete list of Column Chart options visit
<a href="https://developers.google.com/chart/interactive/docs/gallery/columnchart#Configuration_Options">Google Column Charts</a></p>
<h4 id="google-geo-chart-options">Google Geo Chart Options</h4>
<p>The following are some of the Google Charts Geo Chart options, unless otherwise specified.</p>
<pre><code class="lang-javascript">
// Google Geo Chart Options
geoChart: {
// Width of chart in pixels - Number
// Default: automatic (unspecified)
width: null,
// Height of chart in pixels - Number
// Default: automatic (unspecified)
height: 200,
// The chart title - not a Google Geo Chart option
// This option is supported by Chartinator only
title: 'Geo Chart',
titleTextStyle: {
// Note: Support for this option has been added by Chartinator
// but is not supported by Google Charts for this chart type
// The html tag that contains the title Chartinator adds to the top of the chart
// This is supported by Chartinator only
tag: 'h3'
}
// Background Color - Default: 'white'
backgroundColor: '#fff',
// Dataless Region Color - Default: '#F5F5F5'
datalessRegionColor: '#F5F5F5',
// Map Region - String, Options: 'world', continent, region, country, states.
// Default: 'world'
region: 'world',
// Resolution - String
// Options: 'countries', 'provinces', 'metros'. Default: 'countries'
resolution: 'countries',
legend: {
// Legend position - Controls display of legend. String
// Options: 'bottom', 'top', 'left', 'right', 'in', 'none'. Default: right
position: 'right'
},
colorAxis: {
// Start and end colour gradient values. Default: null
colors: []
},
tooltip: {
// String - Shows tooltip with values on hover.
// Options: 'focus', 'none'. Default: focus
trigger: 'focus',
}
},</code></pre>
<p>Note: Google Charts does not apply a heading to this chart type.
Chartinator adds a heading using either the caption from the HTMl data table or the chartTitle option.
For a complete list of Geo Chart options visit
<a href="https://developers.google.com/chart/interactive/docs/gallery/geochart#Configuration_Options">Google Geo Charts</a></p>
<h4 id="google-calendar-chart-options">Google Calendar Chart Options</h4>
<p>The following are some of the Google Charts Calendar Chart options, unless otherwise specified.</p>
<pre><code class="lang-javascript">
// Google Calendar Chart Options
calendar: {
// The cell scaling factor custom option - Not a Google Chart option
// Used to refactor the cell size in responsive designs
// this is overridden if the calendar.cellSize option has a value
cellScaleFactor: 0.017,
// Width of chart in pixels - Number
// Default: automatic (unspecified)
width: null,
// Height of chart in pixels - Number
// Default: automatic (unspecified)
height: 200,
titleTextStyle: {
// Note: Support for this option has been added by Chartinator
// but is not supported by Google Charts for this chart type
color: '#000',
fontWeight: 'bold',
fontName: 'Arial', // Default is body font-family
// The font size in pixels - Number
// Or use css selectors as keywords to assign font sizes from the page
// For example: 'body'
// Default: '' - Use Google Charts defaults
fontSize: 'h3'
},
calendar: {
// Cell size in pixels. Number,
// Default: use cellScaleFactor
cellSize: 16,
monthLabel: {
// Font-family name - String
// Default: the body font-family
fontName: 'Times-Roman',
// The font size in pixels - Number
// Or use css selectors as keywords to assign font sizes from the page
// For example: 'body'
// Default: false - Use Google Charts defaults
fontSize: 'body',
},
dayOfWeekLabel: {
// Font-family name - String
// Default: the body font-family
fontName: 'Arial'
// The font size in pixels - Number
// Or use css selectors as keywords to assign font sizes from the page
// For example: 'body'
// Default: false - Use Google Charts defaults
fontSize: 12,
},
monthOutlineColor: {
// The active month outline stroke colour. String, Default: #000
stroke: '#000',
}
},
colorAxis: {
// The colour gradient start and end values
colors: ['#FF0000', '#00FF00']
},
tooltip: {
// Note: Support for this option has been added by Chartinator
// but is not supported by Google Charts for this chart type
textStyle: {
color: '#000',
fontName: 'Arial', // Default: body font-family
fontSize: 16
}
}
},</code></pre>
<p>For a complete list of Calendar Chart options visit
<a href="https://developers.google.com/chart/interactive/docs/gallery/calendar#Configuration_Options">Google Calendar Charts</a></p>
<h4 id="google-table-chart-options">Google Table Chart Options</h4>
<p>The following are some of the Google Charts Table Chart options, unless otherwise specified.</p>
<pre><code class="lang-javascript">
// Google Table Chart Options
table: {
// The table caption - not a Google Charts option for this chart type
// Chartinator option only
title: 'Table Chart',
// The font size in pixels - Number
// Or use css selectors as keywords to assign font sizes from the page
// For example: 'body'
// Not a Google Charts option for this chart type
fontSize: 16,
// The table caption - not a Google Charts option for this chart type
// Chartinator option only
// Default: the body font-family
fontName: 'Roboto',
// Format a data column in a Table Chart
formatter: {
// Formatter type - String, Options: 'none', 'BarFormat'. Default: 'none'
type: 'none',
// The index number of the column to format - Integer
// Options: 0, 1, 2, etc. Default: 1
column: 1,
// Base value number to compare the cell value against. Default: 0
base: 0,
// Negative bar color - String
// Options: 'red', 'green', 'blue'. Default: 'red'
colorNegative: 'red',
// Positive bar color - String
// Options:'red', 'green', 'blue'. Default: 'blue'
colorPositive: 'green',
// Dark base line when negative values are present.
// Default value is 'false'
drawZeroLine: false,
// Maximum bar value. Number, Default: highest value in table
max: ,
// Minimum bar value. Number, Default; lowest value in the table
min: ,
// Show number values. Boolean, Default: true
showValue: true,
// Thickness of each bar in pixels. Number, Default: 100
width: 100
},
// Allow HTML in cells. Boolean, default: true
allowHtml: true,
// Alternating row styling - Boolean, Default: true
alternatingRowStyle: true,
// Width of chart in pixels. Number, Default: automatic (unspecified)
width: ,
// Height of chart in pixels. Number, Default: automatic (unspecified)
height: ,
// Enable paging - String, Options: enable, event, disable. Default: disable
page: 'disable',
// Rows per page. Integer, Default 10
pageSize: 10,
// Enable row numbers. Boolean, Default: false
showRowNumber: false,
// Enables sorting. String, Options: enable, event, disable. Default: enable
sort: 'enable',
// Sort order. Boolean, Default: true
sortAscending: true,
// The index of a column to sort. Integer, Default: -1
sortColumn: -1,
// CSS class names - Default: no classes
cssClassNames: {
headerRow: 'headerRow',
tableRow: 'tableRow',
oddTableRow: 'oddTableRow',
selectedTableRow: 'selectedTableRow',
hoverTableRow: 'hoverTableRow',
headerCell: 'headerCell',
tableCell: 'tableCell',
rowNumberCell: 'rowNumberCell'
}
},</code></pre>
<p>Note: Google Charts does not apply a table caption to this chart.
Chartinator adds a caption to the table taken from either the HTML data table or the chartTitle option.
For a complete list of Table Chart options visit
<a href="https://developers.google.com/chart/interactive/docs/gallery/table#Configuration_Options">Google Table Charts</a></p>
<h3 id="styling-tooltips">Styling Tooltips</h3>
<p>Google Charts HTML enabled tooltips can be styled using the relevant CSS classes.
Chartinator adds a style element to the head of the document to apply custom styles to tooltips for for certain chart types.
The default Google Charts tooltip CSS is located at: <a href="https://ajax.googleapis.com/ajax/static/modules/gviz/1.0/core/tooltip.css">https://ajax.googleapis.com/ajax/static/modules/gviz/1.0/core/tooltip.css</a></p>
<h3 id="dependencies">Dependencies</h3>
<p>jQuery, Google Charts</p>
<h3 id="how-to-run-tests">How to run tests</h3>
<p>No testing framework at this time</p>
<h3 id="task-managers">Task Managers</h3>
<p>Gruntfile.js and package.json files are included if you want to manage tasks using Grunt.<br>Note: The Grunt file uses configuration information contained in the package.json</p>
<h3 id="deployment-instructions">Deployment instructions</h3>
<p>The git repo is versioned and includes a Bower configuration file so the repo can be easily included in your project as a dependency.</p>
<h2 id="contribution-guidelines">Contribution guidelines</h2>
<p>Contributions are much appreciated and welcomed.</p>
<h3 id="who-do-i-talk-to-">Who do I talk to?</h3>
<p>jbowyers</p>