+ Reply to Thread
Results 1 to 17 of 17

Is it possible to link multiple graphs?

  1. #1
    Registered User
    Join Date
    11-18-2014
    Location
    Spain
    MS-Off Ver
    2010
    Posts
    14

    Question Is it possible to link multiple graphs?

    Ok, so I'm not very sure as to how to explain this, but I'll try my best.

    Currently I'm trying to make 4 dynamic graphs that're linked to one another.

    The data that feeds these graphs is represented in the following way:

    Captura.JPG

    So each line represents a delivery of a certain customer, and depending on the type of delivery, the 'detail' goes on either TEUS, CBM, or Chargeable weight.

    My problem is as follows: I'm trying to make on a main Sheet and put 4 separate line graphs in it with their X axis representing the months 1 through 12 and the Y axis being the totals of each month. Graph 1 would be for Net Sales, Graph 2 for TEUS, graph 3 for CBM and graph 4 for chargeable weight.

    Something like this:

    Sin título.png

    With the catch that when changing the filter options in the first graph (such as selecting a particular client/direction /origin /destination) and such, the other three graphs reflect the data pertinent to that at the same time rather than you having to manually go over each one to select the particularities.

    I'm using Microsoft Excel 2010 and have some knowledge in VBA though it's been mostly self-taught through trial and error. Is my idea possible in any way?
    Last edited by marioggf21; 02-12-2015 at 05:49 AM.

  2. #2
    Registered User
    Join Date
    03-08-2014
    Location
    United Kingdom
    MS-Off Ver
    Office 2010, Office 2013 & Office 2016 / 365
    Posts
    23

    Re: Is it possible to link multiple graphs?

    As far as I am aware this is not achievable in the way you describe however you can add filters to the data which the charts work off by using Data -> Filter. Any filters you set this way will change all the charts linked to this data.

    There may be another way but this is the simplest

  3. #3
    Registered User
    Join Date
    11-18-2014
    Location
    Spain
    MS-Off Ver
    2010
    Posts
    14

    Re: Is it possible to link multiple graphs?

    Thanks for the advice, and I tried that already.

    Problem is, these charts aren't meant for me to use them, they're for... let's call them 'impatient and less excel savvy people'. I already tried suggesting the data filter options but it quickly got booted because they'd need a partial class on how to work it out whenever they want to get to the information.

    I need to be able to somehow access the filter options directly from the 'controls' for the first graph to make for a faster and easier way of managing the various options. Or at least a way to easily manage all 4 graphs at the same time from the same place.

    But as you mentioned, it may not be possible. I'm trying to confirm since most of what I know comes from daily use one way or another and though I've had to do a whole lot of VBA I haven't got a clue about how to go around this issue. I'm pretty much dreading the likeliness of the only way of doing this to be through some lengthy and complicated process, but it's the results that's being taken into consideration here, not the effort or difficulty

    PS: Forgot to add that the people who're in charge of this DON'T want the ones that're going to use them to have direct access to anything other than the graphs and its controls... for reasons that appear to be above my pay-grade.
    Last edited by marioggf21; 02-12-2015 at 07:52 AM.

  4. #4
    Registered User
    Join Date
    03-08-2014
    Location
    United Kingdom
    MS-Off Ver
    Office 2010, Office 2013 & Office 2016 / 365
    Posts
    23

    Re: Is it possible to link multiple graphs?

    Ah I understand, I think this is possible if you had a pivot table for each chart (all off the same default data) and each having their own pivot graphs (which I think you already have).

    Make sure each pivot table has a name.

    With reference to: https://msdn.microsoft.com/en-us/lib...ice.14%29.aspx and http://www.thespreadsheetguru.com/bl...l-pivot-tables

    By using the

    Please Login or Register  to view this content.
    You can then use this to change the other pivot tables accordingly by using code similar to this:

    Please Login or Register  to view this content.
    Of course you can be selective of any changes.

    I have not tested all the code, but have used similar in the past. Have a read through the site's i've linked - they may give you a better insight into what I am talking about.

    Sorry if its not clear or what you need but unfortunately each pivot can only have one graph and using vba is probably the only way to go.

  5. #5
    Registered User
    Join Date
    11-18-2014
    Location
    Spain
    MS-Off Ver
    2010
    Posts
    14

    Re: Is it possible to link multiple graphs?

    I'm going to have a go at it and post results (good or bad) once I get them and call it done.

    Thanks for the help!

  6. #6
    Registered User
    Join Date
    11-18-2014
    Location
    Spain
    MS-Off Ver
    2010
    Posts
    14

    Re: Is it possible to link multiple graphs?

    Ok, so I've been tinkering with it and reading everything, but I can't seem to make it work for some reason. It's most likely because I don't have a clue as to how to activate it. And I literally did a copy/paste of the first piece of code to confirm it wasn't a mistake I've made in the coding for some reason.

    I've got all four pivot tables ("NetSales","TEUS","WM" & "KG") along with their corresponding "Graph1""Graph2"..."Graph4" and can't seem to either make it work nor activate/find the macro. I'm feeling completely lost over here because once I've placed the private sub nothing I do gets me a popup, much less change the fields in the other tables.

    Is there anything I have to do once I've made the macro and named it so it runs? Or am I missing something here?
    Last edited by marioggf21; 02-12-2015 at 10:27 AM.

  7. #7
    Registered User
    Join Date
    03-08-2014
    Location
    United Kingdom
    MS-Off Ver
    Office 2010, Office 2013 & Office 2016 / 365
    Posts
    23

    Re: Is it possible to link multiple graphs?

    The code that should run "on change" should not be within a macro but within the worksheet code.

    View the visual basic window and double click on a worksheet, and paste the code in there - this should activate when the pivot changes. You probably will need to do this on every sheet there is a pivot table

  8. #8
    Registered User
    Join Date
    11-18-2014
    Location
    Spain
    MS-Off Ver
    2010
    Posts
    14

    Re: Is it possible to link multiple graphs?

    I've been trying to add the line of code with the whole "ActiveSheet.PivotTables...("Field1").PivotItems" in a multitude of ways.

    I keep getting either error 438 "Object doesn't accept this property or method" or I get "can't assign _Default to PivotField class."

  9. #9
    Registered User
    Join Date
    03-08-2014
    Location
    United Kingdom
    MS-Off Ver
    Office 2010, Office 2013 & Office 2016 / 365
    Posts
    23

    Re: Is it possible to link multiple graphs?

    Ah sorry my mistake, each pivot fields' values have to be done individually so you could have something like this:

    Please Login or Register  to view this content.
    That code or similar should do the trick - and do this for each field in the pivot table and hopefully it will work ?

  10. #10
    Registered User
    Join Date
    11-18-2014
    Location
    Spain
    MS-Off Ver
    2010
    Posts
    14

    Re: Is it possible to link multiple graphs?

    Hello, been trying it out, and I've been entering an infinite loop somehow.

    This is what I've got:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The first if is because before, as soon as it tried to modify the "TEUS" pivot table, it'd re-launch itself. But even with that, it goes over and over again with the net sales pivot table (don't know why though) so all I get is a popup that launches itself again over and over without anything changing at all.

    I went through the 'Step by Step' and once it got to the first line after "For" it went at it once again.

    I've tried several modifications to that but nothing's gotten anywhere. Not even the "TEUS" pivot table shows variations of any sort so I'm as lost as before.

  11. #11
    Registered User
    Join Date
    03-08-2014
    Location
    United Kingdom
    MS-Off Ver
    Office 2010, Office 2013 & Office 2016 / 365
    Posts
    23

    Re: Is it possible to link multiple graphs?

    Ah, the reason why it is in an endless loop probably is because every change the function is continually called. Perhaps this may be a better solution:

    Please Login or Register  to view this content.
    This should stop an "infinite loop" - if this doesn't work i'm not sure what to try next. Let me know how it goes.

  12. #12
    Registered User
    Join Date
    11-18-2014
    Location
    Spain
    MS-Off Ver
    2010
    Posts
    14

    Re: Is it possible to link multiple graphs?

    Did a minor modification to the code
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And though both popups pop, none of the fields in "TEUS" changes, apparently the whole thing running through it without changing the filters. Triple checked the names and field tags to make sure that part's correct, but I don't find anything in that regard.

  13. #13
    Registered User
    Join Date
    03-08-2014
    Location
    United Kingdom
    MS-Off Ver
    Office 2010, Office 2013 & Office 2016 / 365
    Posts
    23

    Re: Is it possible to link multiple graphs?

    Ok at least it's out of the loop can you just add these lines to the top of the loop

    Please Login or Register  to view this content.
    And see what happens as this will ultimately decide any changes.

  14. #14
    Registered User
    Join Date
    11-18-2014
    Location
    Spain
    MS-Off Ver
    2010
    Posts
    14

    Re: Is it possible to link multiple graphs?

    Ok, ran it through. Got the initial double popup and then the first name on the list followed by "True".

    Selected multiple items, selected random items, selected all items, selected the last, selected the first (on the main one meant to change the others).

    Then I began doing the same with "TEUS", and though it still showed only the first item on the list, it would only be "True" when said item was selected. Same result each time. Though if I unselected it from "TEUS" it would show "False" though still no more names.

    Then I changed the command in the loop to:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And though it still doesn't move past the first iteration of the loop, if I unselect the first item on the list it'll be mimicked on "TEUS" (so we can't be too far off).

  15. #15
    Registered User
    Join Date
    03-08-2014
    Location
    United Kingdom
    MS-Off Ver
    Office 2010, Office 2013 & Office 2016 / 365
    Posts
    23

    Re: Is it possible to link multiple graphs?

    Ok if you remove the three lines that I listed above, does it move past the first iteration?

  16. #16
    Registered User
    Join Date
    11-18-2014
    Location
    Spain
    MS-Off Ver
    2010
    Posts
    14

    Re: Is it possible to link multiple graphs?

    nope. Still just checks/unchecks the first item so it matches the "master" pivot table

  17. #17
    Registered User
    Join Date
    11-18-2014
    Location
    Spain
    MS-Off Ver
    2010
    Posts
    14

    Re: Is it possible to link multiple graphs?

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Ok, so I've applied this and it works so that the FIRST difference between "NetSales" and "TEUS" is fixed. So that if, for example, my filter options are: AA, BB, CC, DD, EE, FF and GG.

    If I unselect one in NetSales, say BB, then in TEUS BB will be unselected. But if I unselected BB and DD, then in TEUS only BB would be unselected. Same applies with selecting something that's already selected.

    Unfortunately, the filter list for the project is... well, enormous. Just applying the filter in one of the options starting with "V" gets a 3 minute wait time before it's applied to TEUS as well. So (for better or worse), this aspect of the project has been scrapped. I may or may not look for a way for this to apply ALL filter changes, but for the time being that's going to remain an idea and nothing more.

    Thanks for the help and I'm going to label this post SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Link multiple, identical graphs to multiple data tables
    By HJII in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 03-05-2014, 10:02 AM
  2. multiple graphs on one screen and moving graphs
    By mufan in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-12-2014, 04:49 PM
  3. How to link Droplist options with Graphs
    By PuckBunny in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-27-2009, 06:13 AM
  4. How to link data from Excel to Word including graphs
    By supraman3001 in forum Word Programming / VBA / Macros
    Replies: 0
    Last Post: 05-21-2009, 05:17 PM
  5. [SOLVED] Link to powerpoint resizing graphs
    By Landxlii in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-06-2005, 04:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1