Skip to content

Instantly share code, notes, and snippets.

@tylor
Created May 12, 2011 18:35
Show Gist options
  • Save tylor/969155 to your computer and use it in GitHub Desktop.
Save tylor/969155 to your computer and use it in GitHub Desktop.
Give yhahn/searchlight_graphael horizontal bar charts, depends on http://drupal.org/node/1155710
diff --git plugins/searchlight_graphael_box.inc plugins/searchlight_graphael_box.inc
index 60116c1..34394c9 100644
--- plugins/searchlight_graphael_box.inc
+++ plugins/searchlight_graphael_box.inc
@@ -30,6 +30,7 @@ class searchlight_graphael_box extends boxes_box {
'#options' => array(
'pie' => t('Pie'),
'bar' => t('Bar'),
+ 'hbar' => t('Horizontal Bar'),
'line' => t('Line'),
'dot' => t('Dot'),
),
diff --git searchlight_graphael.module searchlight_graphael.module
index 8ba5a33..3aeb022 100644
--- searchlight_graphael.module
+++ searchlight_graphael.module
@@ -4,7 +4,7 @@
* Build gRaphael graph parameters from a search facet.
*
* @param string $pie
- * The gRaphael method to use. Either 'pie', 'bar', 'line', or 'dot'.
+ * The gRaphael method to use. Either 'pie', 'bar', 'hbar', 'line', or 'dot'.
* @param string $datasource
* The Searchlight datasource to use for faceting.
* @param string $environment
@@ -48,6 +48,7 @@ function searchlight_graphael_build($method = 'pie', $datasource, $environment =
$graph = array('method' => $method, 'values' => array(), 'params' => array(), 'extend' => array());
switch ($method) {
case 'bar':
+ case 'hbar':
foreach ($facets as $item) {
$graph['values'][] = (int) $item['count'];
$graph['extend']['label']['values'][] = truncate_utf8($item['title'], 30, TRUE, TRUE) . "\n" . $item['count'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment