Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clickable charts #968

Closed
anush opened this issue Sep 4, 2009 · 11 comments
Closed

Clickable charts #968

anush opened this issue Sep 4, 2009 · 11 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.

Comments

@anush
Copy link

anush commented Sep 4, 2009

Allow charts to track click events and perform a certain action. The action taken can be:

  1. Javascript - a JS function is invoked
  2. URL - a new URL is loaded into the browser window
    3. Datafile - a new datafile is loaded into the chart

Open Flash Chart does support on-click events (see Open Flash Chart On-click).

I propose adding support for a "special" column (like "label"), say "click_url", which Piwik's widgetize module would recognize and add on-click functionality to the chart. Each data value in that column would either be a JS function, a URL or a [module,action] pair (for datafile).

I think adding interactivity to the charts would be a great feature!
Keywords: chart, graph

@robocoder
Copy link
Contributor

Piwik already uses this feature but does not expose it as a general purpose feature to widget authors.

@robocoder
Copy link
Contributor

"Datafile" isn't possible with the current version of OFC2.

@robocoder
Copy link
Contributor

URL is already supported by the Evolution chart. See Piwik_Visualization_Chart->setAxisXOnClick().

@mattab
Copy link
Member

mattab commented Sep 8, 2009

anush, did you try using Piwik_Visualization_Chart->setAxisXOnClick() ?

Does it work as expected for you? if yes, we could close the ticket.

@anush
Copy link
Author

anush commented Sep 8, 2009

I did take a look after vipsoft mentioned it. I wasn't having too much luck with it for my development purposes. Then again, my dev environment is in bit of disarray at the moment. Give me another day or two -- I can delve a bit more deeper and definitively say "yay" or "nay".

Thanks for your diligence.

@anush
Copy link
Author

anush commented Sep 15, 2009

Attachment: on-click support in pie charts
Pie.php.patch

@anush
Copy link
Author

anush commented Sep 15, 2009

Ok, here are my thoughts...

  1. The evolution chart is clickable, but not extensible. It currently is hardcoded to link back to the CoreHome module only. I think it would be great if we could make this a bit more extensible such that the on-click could be a custom JS call or URL. See: Piwik_ViewDataTable_GenerateGraphData_ChartEvolution->initChartObjectData()
  2. The other two types of charts (pie and vertical bar), although they have the setAxisXOnClick() method, the on-click values do not appear to be used during rendering. I believe the Piwik_Visualization_Chart->customizeChartProperties() method should be updated to take the on-click values into account (see Pie.php.patch).
  3. Even with the on-click values being accounted for in the charts, there is currently no easy way to set the on-click values from the controller (or maybe I just dont know how?). It appears as though there is no way to set the on-click event on a "per-chart" basis -- I can only see a way to set the on-click on a "per-datapoint" basis. I feel it would be useful for the onclick event to derive data from a column on the dataTable itself. So, I think the setAxisXOnClick() (or perhaps a new method) should be able to take a URL pattern or JS function and a column name from which a dynamic value should be derived. e.g:
#!php
// %s is dynamically replaced by the value in the specified column (in this case, "label")
setAxisXOnClickURL('http://example.com?page=%s', 'label'); 
setAxisXOnClickJS('alert(%s)', 'label');

@mattab
Copy link
Member

mattab commented Sep 22, 2009

1- agreed. Would you be able to provide a patch for this?
2- patch looks good, we can commit, let's wait for 1) and 3)
3- again, agreed with the concept. if you are able to provide a patch for this, it would help getting it done.

@anush
Copy link
Author

anush commented Sep 24, 2009

sure, i'll try to take a stab at 1 & 3.

@mattab
Copy link
Member

mattab commented Jan 8, 2010

anush, any update?

@mattab
Copy link
Member

mattab commented Jul 29, 2010

no news from dev, wont fix. Please comment if any update.

@anush anush added this to the Future releases milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Projects
None yet
Development

No branches or pull requests

3 participants