I can't get Chart add-on working. No matter what I try, I get the error: "This chart add-on must have a parent chart selected under the chart settings."
When I choose "Parent Display= Master", the error goes away but then it doesn't show the Chart add-on.

(The parent page and the Chart add-on does separately show the correct charts, but I can't get them combined.)

Is this a bug or am I doing something wrong?

Comments

quicksketch’s picture

Can you try setting up a chart that's not the master as the parent chart? Using the master chart will only work if you directly embed the master chart somewhere else, such as in a panel.

dalearyous’s picture

this issue is also found here: https://drupal.org/node/2052429 (post #16, i am post #17 and glad i found this).

so the master cannot be the parent chart?

edit* i recreated the view with a master, a page with chart, and an add-on chart and i still have the same issue. what the hell?

Jovean’s picture

I have the same issue. In other words: an error is shown (exactly as OP mentioned) when I choose a display as the parent chart other then "Master".

The charts are also not combined in the parent display (which is a block display, in my case).

rudyard55’s picture

Have you tried:

  1. start with a table using minimal filters
  2. Save your work
  3. create a new page and name it "parent chart"
  4. Save your work
  5. then change the type of the new page to chart
  6. add your filters
  7. Save your work
  8. Then create the chart addon and link it to your "parent chart"
  9. Save again and update the preview
  10. *Don't forget to remove any sorts and choose display all content
Jovean’s picture

Except for creation of a page display - I needed to use a block display, so I could use the chart in panels - I followed exactly this procedure.

rudyard55’s picture

Jovean, On working further with the chart addons with additional datasets, I've also come to find odd behavior. I've had "extra" columns show up that don't resolve back to valid data pairs. A column will appear with a duplicated numeric value that doesn't resolve back to a labeling field. I suspect an error is occurring during aggregation. In my case, I only trust the module to display datasets with a single data column at this juncture. With one data column I can get consistent accurate results. At the point of using the "chart addon" to try to display additional values, the odd behaviors begin.

alibama’s picture

definitely buggy = the page views simply don't work with chart-add-ons... bummer... hopefully see some improvement here, otherwise the best charting module in drupal

Roensby’s picture

I think I know why this issue occurs.

My variant of this issue: The error message "This chart add-on must have a parent chart selected under the chart settings." is accompanied by two instances of this error message:

"Notice: Undefined index: style_plugin in charts_plugin_style_chart->get_parent_chart_display() (line 321 of .../sites/all/modules/charts/views/charts_plugin_style_chart.inc)."

The function get_parent_chart_display assumes that $parent_display->display_options['style_plugin'] is set, which it will be if the parent chart view display is overridden.

However, if the view display relies on the master display, $parent_display->display_options['style_plugin'] is not set, since the parent view display just takes whatever display format the master display has.

I'm not sure if that is how Views operates, but my claim is supported by the fact that if I override the display format of my parent chart and set it to chart ( even though it already is set to chart by virtue of the master display ), the add-on chart works again.

I hope that makes sense :)

Roensby’s picture

We simply change this line in charts_plugin_style_chart.inc:

if ($parent_display && $parent_display->display_options['style_plugin'] !== 'chart') {

to this

if ($parent_display && ((isset($parent_display->display_options['style_plugin']) && $parent_display->display_options['style_plugin'] !== 'chart') || (!isset($parent_display->display_options['style_plugin']) && $this->view->display['default']->display_options['style_plugin'] !== 'chart'))) {

This covers both cases: When the parent chart has overriden the master display and when it hasn't.

alibama’s picture

@CChow thanks man = I'll test this patch in just a bit, sounds promising

alibama’s picture

This patch fixed everything for me... RTBC +1 & Thank you CChow

ethanhinson’s picture

#9 fixed this problem for me too. Thanks!

codekarate’s picture

Status: Active » Reviewed & tested by the community

#9 works for me too. RTBC +1

ryantollefson’s picture

#9 fixed the major issue I was having. Thanks.

However, the add-on chart portion doesn't seem to respect filters that are on the parent chart. When I apply a filter to the parent, the add-on labels disappear (and are replaced with numbers), but the columns still appear.

hellogeli’s picture

I used relationship to grab a webform submission data from the user and display that in the add on chart. It is showing in the add on chart but not in the parent chart. What should I do, please?

Pierre.Vriens’s picture

Pierre.Vriens’s picture

Status: Reviewed & tested by the community » Patch (to be ported)
Pierre.Vriens’s picture

Title: Chart add-on doesn't work » Parent chart missing for chart add-on

Sorry for the time to get this issue moving forward. I needed time to become familiar with the charts code, features and terminology (and I'm still learning, sorry ...). However now I feel more comfortable moving forward with this not-so-obvious issue, so I'm going to move ahead with the patch in #9 (thanks for it @CChow !). I'm also slightly adapting the title.

However, it appears to me that at least in #14 there might be some other "related" issue, which potentially will not be resolved by this patch (maybe also for #15?). If that's the case, please create a NEW issue where appropriate, splitting problems in different issues makes each of them more manageable, OK?

ryantollefson’s picture

Thanks Pierre. I will try the latest version.

Pierre.Vriens’s picture

Thank you Ryan, that's how we get things moving forward. Keep us informed about your results please: an extra comment in this issue (if it is resolved), or a new issue (with reference to #14 maybe if it is not), OK?

sajosh’s picture

I was getting both errors (original post and #8). Patch in #9 fixed errors. Two charts work now.

As for #14, I have a filter on the parent chart which is being respected. Perhaps my setup is different.

Thanks for making this module and the fix.

I'm on D7.36, Charts 7.x-2.0-rc1+5-dev, Views 7.x-3.11

dqd’s picture

Version: 7.x-2.0-rc1 » 7.x-2.x-dev
Priority: Normal » Major

Has this patch been ever committed?

Error still persists in latest dev and makes using the Chart overlay add on view impossible, since the error keeps the view in the error status stage, not be able to be saved ever. Only disabling and removing the Add on view again makes it possible to save the whole views view. Since this is a denoted feature which makes this module outstanding from other modules in this category we should consider this bug as major to get fixed asap. (?)

The whole described functionality from http://cgit.drupalcode.org/charts/tree/README.txt line 91-117 is broken atm.

Issues in the comments #14 and #15 are not related and should be filed separately. Especially #14 could be a configuration error since the add on can not overlay on outranging scale. If the parent label range is exceeded from the overlay, the rest would be shown as default scale numbers. This works as designed. In this case it should be considered to flip the order from which is parent and which is overlay to prevent this behavior.

dqd’s picture

#16 / #17 Please consider the patch for available versions from the project page (at least latest 7.x dev - the Drupal way) since this patch doesn't implement an API change and the bug breaks denoted functionality.

dqd’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

Tested with latest dev and applied without any conflicts. Bug disappears.

mwidner’s picture

I also tested patch in #9 against the latest dev code. Also confirming that the patch gets rid of this error when trying to combine with a parent chart.

jbabiak’s picture

Patch #9 worked great, Thanks!

drunken monkey’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.07 KB

I think the current solution is a bit too complicated, we can just use get_option() here – that's exactly what this method is there for.
Also, the same was used to solve virtually the same problem in #2219973: Sub-charts cannot be attached to displays that inherit from defaults (don't know why it popped up again, don't know much about this module).
Patch attached, seems to work fine for me.

drunken monkey’s picture

Title: Parent chart missing for chart add-on » Parent style plugin check of the chart add-on display doesn't respect default

Making the issue title (hopefully) a bit clearer, though it's hard to express this issue concisely.

samuel.seide’s picture

Patch #9 worked for me. I used this patch to implement a "target line" using the column graph and then overlaid a line graph for the target line.

andileco’s picture

@drunken-monkey's patch (#27) worked for me, although I had to go through all the displays and reset the display options, and it was looking like it wouldn't work for a few minutes.

andileco’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.