PANDA

Economies page - Transactions

Recommended Posts

Is it possible to change bar chart to show designated groups or individual members?

For example it currently shows this:

eco1.thumb.PNG.906e83cb3160b1235df0a0523d214eeb.PNG

But i'd like to use maybe secondary groups or even every individual member.

Also is there a way to get very transaction made on this page?

Currently I can only see my own transactions, I need to see all transactions really

Thanks

 

Edited by PANDA

Share this post


Link to post
Share on other sites

The chart is built by the Currency object (IPS\points\Currency) and fetched and displayed in the template (front/economies/currencyOverview).

Here is an example of the code inside the Currency::groupDistributionChart() method which creates the chart.

	public function groupDistributionChart()
	{
		$chart = new \IPS\points\Chart;
		
		$chart->addHeader( \IPS\Member::loggedIn()->language()->addToStack( 'points_chart_member_group' ), 'string' );
		$chart->addHeader( \IPS\Member::loggedIn()->language()->addToStack( 'points_chart_net_worth' ), 'number' );
		
		foreach( \IPS\Member\Group::groups( TRUE, FALSE ) as $group )
		{	
			$worth = $this->circulating( FALSE, $group->g_id );
			if ( $worth !== 0 )
			{
				$chart->addRow( array( $group->name, $this->round( $worth ) ) );
			}
		}
		
		return $chart;		
	}

Here is an example of a template snippet that displays it.

{$chart->render( 'BarChart', array( 'orientation' => 'vertical', 'title' => \IPS\Member::loggedIn()->language()->addToStack( 'points_net_worth_distribution' ), 'legend' => array( 'position' => 'none' ) ) )|raw}

You can feel free to build your own charts if you like. The IPS\points\Chart class is a subclass of the IPS\Helpers\Chart class which has some documentation here: https://codingjungle.com/phpdoc/4119/dc/d69/classIPS_1_1Helpers_1_1Chart.html

Share this post


Link to post
Share on other sites
3 hours ago, Kevin Carwile said:

The chart is built by the Currency object (IPS\points\Currency) and fetched and displayed in the template (front/economies/currencyOverview).

Here is an example of the code inside the Currency::groupDistributionChart() method which creates the chart.

	public function groupDistributionChart()
	{
		$chart = new \IPS\points\Chart;
		
		$chart->addHeader( \IPS\Member::loggedIn()->language()->addToStack( 'points_chart_member_group' ), 'string' );
		$chart->addHeader( \IPS\Member::loggedIn()->language()->addToStack( 'points_chart_net_worth' ), 'number' );
		
		foreach( \IPS\Member\Group::groups( TRUE, FALSE ) as $group )
		{	
			$worth = $this->circulating( FALSE, $group->g_id );
			if ( $worth !== 0 )
			{
				$chart->addRow( array( $group->name, $this->round( $worth ) ) );
			}
		}
		
		return $chart;		
	}

Here is an example of a template snippet that displays it.

{$chart->render( 'BarChart', array( 'orientation' => 'vertical', 'title' => \IPS\Member::loggedIn()->language()->addToStack( 'points_net_worth_distribution' ), 'legend' => array( 'position' => 'none' ) ) )|raw}

You can feel free to build your own charts if you like. The IPS\points\Chart class is a subclass of the IPS\Helpers\Chart class which has some documentation here: https://codingjungle.com/phpdoc/4119/dc/d69/classIPS_1_1Helpers_1_1Chart.html

I appreciate the reply and help but this kind of thing is far beyond my level comprehension. Is there anything I could read to maybe gain some understanding? I don't even know where I'd enter these codes tbh.

Thanks

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.