TheJackal84 Posted August 26, 2017 Posted August 26, 2017 I have a couple of questions on the $chart feature How do I set the default view? anytime I try it is always on the AreaChart view, even if I remove it from the $chart->availableTypes If I put it to show in the front end then when I change the view it always gives a url with &type[e7e453]=BarChart&noheader=1 and it takes away the date filter and the view filters, if i remove the no from noheader it's all there, Although in the admin panel it all works fine
TheJackal84 Posted August 27, 2017 Author Posted August 27, 2017 I managed to do the noheader one, All I need to know is how to set the default view if anyone can help
bfarber Posted August 28, 2017 Posted August 28, 2017 /** * Constructor * * @param \IPS\Http\Url $url The URL the chart will be displayed on * @param string $table Database Table * @param string $dateField Database column that contains date * @param string $title Title * @param array $options Options * @param string $defaultType The default chart type * @param string $defaultTimescale The default timescale to use * @param array $defaultTimes The default start/end times to use * @param array $tableInclude Table columns to include in results * @param string $identifier If there will be more than one chart per page, provide a unique identifier * @param \IPS\DateTime|NULL $minimumDate The earliest available date for this chart * @see <a href='https://google-developers.appspot.com/chart/interactive/docs/gallery'>Charts Gallery - Google Charts - Google Developers</a> * @return void */ public function __construct( \IPS\Http\Url $url, $table, $dateField, $title='', $options=array(), $defaultType='AreaChart', $defaultTimescale='monthly', $defaultTimes=array( 'start' => 0, 'end' => 0 ), $tableInclude=array(), $identifier='', $minimumDate=NULL ) I assume you are using a dynamic chart (e.g. \IPS\Helpers\Chart\Database), and if so you would pass the default view as the 6th parameter to the constructor. See applications/core/modules/admin/activitystats/keywords.php as an example that uses a LineChart by default.
TheJackal84 Posted August 28, 2017 Author Posted August 28, 2017 40 minutes ago, bfarber said: I assume you are using a dynamic chart (e.g. \IPS\Helpers\Chart\Database), and if so you would pass the default view as the 6th parameter to the constructor. See applications/core/modules/admin/activitystats/keywords.php as an example that uses a LineChart by default. Perfect thanks, works like a charm
Recommended Posts
Archived
This topic is now archived and is closed to further replies.