I'm trying to override chart options, i'm trying this with google charts.
Seems like hooks are not implemented yet. hooks in charts.api.php file are not working now.
Is there any other way to override options?

Comments

Anas_maw created an issue. See original summary.

andileco’s picture

The API probably needs to be replaced. I would recommend relying more on the plugin system and do something like I did in the following link. If this doesn't accommodate your use case, I would love to hear more about it. You may also want to look at the Charts Blocks sub-module included in the latest -dev.

https://github.com/andileco/chart_block_example

Let me know how things go--I'm really interested in making this an awesome module!

Anas_maw’s picture

I had a look on both modules, both are creating a new chart in block.
To be more clear i have a view which render a google chart. i want to add more options which are not provided in the module.
We have two options:
1. Implements all options in setting form. (Which i thing it's hard to cover all options.)
2. Alter options in code before generating the chart and add our custom options.

Do you have any idea how we can reach this?

andileco’s picture

One idea might be to implement a custom Views style plugin with a raw_options field. I'll think more about it. If you have a different idea, please let me know!

andileco’s picture

Heads up that pretty soon I'll be committing some code that allows for this. I'll need testers, if you're still interested.

  • andileco committed 2625df6 on 8.x-3.x
    Issue #2945629 by andileco, mwebaze: Override options
    

  • andileco committed 7203711 on 8.x-3.x
    Issue #2945629 by andileco, mwebaze: Override options
    
andileco’s picture

Status: Active » Needs review

Might need a good bit of work still, but this is something to try now. I need to step away a little, as I have been looking at it too closely.

andileco’s picture

I've created a "starterkit" module that can be placed in modules/custom and be modified by the user.

  • andileco committed 3b1f795 on 8.x-3.x
    Issue #2945629 by andileco: Override options
    
andileco’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

DrIPA’s picture

@andileco is there any news about the #raw_options in views? I've installed the latest 4.x dev version but it seems there is no support for raw_options in the views plugin style.