function flot_example_page in Flot 7
1 string reference to 'flot_example_page'
- flot_example_menu in flot_example/flot_example.module
- Implements hook_menu
File
- flot_example/flot_example.module, line 26
Code
function flot_example_page() {
$content = '<h3>' . t('Lines') . '</h3>';
$d1 = new flotData(array(
array(
0,
1,
),
array(
4,
8,
),
array(
8,
5,
),
));
$d1->label = t('Example data 1');
$d2 = new flotData(array(
array(
0,
8,
),
array(
3,
5,
),
array(
8,
0.5,
),
));
$d2->label = t('Example data 2');
$d1->lines = new flotLine(array(
'lineWidth' => 5,
));
$d1->points = new flotPoint(array(
'radius' => 5,
));
$variables = array(
'data' => array(
$d1,
$d2,
),
'element' => array(
'id' => 'flot-example-normal',
'class' => 'flot-example',
'style' => "width:600px;height:400px",
),
'legend' => TRUE,
'zoom' => TRUE,
);
$content .= theme('flot_graph', $variables);
$content .= '<h3>' . t('Points') . '</h3>';
$d1 = new flotData(array(
array(
0,
1,
),
array(
4,
8,
),
array(
8,
5,
),
));
$d1->label = t('Example data 1');
$d1->points = new flotPoint(array(
'fillColor' => '#EDC240',
));
$d2 = new flotData(array(
array(
0,
8,
),
array(
3,
5,
),
array(
8,
0.5,
),
));
$d2->label = t('Example data 2');
$d2->points = new flotPoint();
$variables = array(
'data' => array(
$d1,
$d2,
),
'element' => array(
'id' => 'flot-example-normal',
'class' => 'flot-example',
'style' => "width:600px;height:400px",
),
'legend' => TRUE,
'zoom' => TRUE,
);
$content .= theme('flot_graph', $variables);
$content .= '<h3>' . t('Bars') . '</h3>';
$d1 = new flotData(array(
array(
0,
1,
),
array(
4,
8,
),
array(
8,
5,
),
));
$d1->label = t('Example data 1');
$d1->bars = new flotBar(array(
'lineWidth' => 1,
'barWidth' => 1,
));
$d2 = new flotData(array(
array(
0,
8,
),
array(
3,
5,
),
array(
8,
0.5,
),
));
$d2->label = t('Example data 2');
$d2->bars = new flotBar();
$variables = array(
'data' => array(
$d1,
$d2,
),
'element' => array(
'id' => 'flot-example-normal',
'class' => 'flot-example',
'style' => "width:600px;height:400px",
),
'legend' => TRUE,
'zoom' => TRUE,
);
$content .= theme('flot_graph', $variables);
$content .= '<h3>' . t('Pie') . '</h3>';
$d1 = new flotData(30);
$d1->label = t('Example data 1 (30%)');
$d1->pie = new flotPie();
$d2 = new flotData(70);
$d2->label = t('Example data 2 (70%)');
$d2->pie = new flotPie();
$variables = array(
'data' => array(
$d1,
$d2,
),
'element' => array(
'id' => 'flot-example-normal',
'class' => 'flot-example',
'style' => "width:600px;height:400px",
),
'legend' => FALSE,
'options' => array(
'pie' => TRUE,
),
);
$content .= theme('flot_graph', $variables);
$content .= '<h3>' . t('Combination') . '</h3>';
$d1 = new flotData(array(
array(
0,
1,
),
array(
4,
8,
),
array(
8,
5,
),
));
$d1->label = t('Example data 1');
$d1->lines = new flotLine();
$d1->points = new flotPoint();
$d1->bars = new flotBar();
$d2 = new flotData(array(
array(
0,
8,
),
array(
3,
5,
),
array(
8,
0.5,
),
));
$d2->label = t('Example data 2');
$d2->lines = new flotLine();
$d2->points = new flotPoint();
$d2->bars = new flotBar();
$variables = array(
'data' => array(
$d1,
$d2,
),
'element' => array(
'id' => 'flot-example-normal',
'class' => 'flot-example',
'style' => "width:600px;height:400px",
),
'legend' => TRUE,
'zoom' => TRUE,
);
$content .= theme('flot_graph', $variables);
return $content;
}