When using the Views Style Plugin for Visualization there is no option to set a title for the chart and the yAxis title is not saved and displayed correctly. Proposed patch to include option for setting the chart title, exclude the chart title completely and resolve the yAxis title bug.

Please review patch below http://drupal.org/node/1908688#comment-7049348

Comments

tim.foxell’s picture

Assigned: Unassigned » tim.foxell
Status: Active » Needs work

Having slept on this and done a bit of reading on style plugins this morning I have managed to resolve this.
I've included a field for the chart Title, with a default of "Chart 1" and kept the fall back of the $view->human_name set in visualization.theme.inc.

I noticed that the yAxis title was not being stored and have resolved this also. However it does not get displayed on the chart when rendered. If you point me in the direction of where that is processed I'm more than happy to take a look at that as well.

I'll supply a patch as soon I work that one out...

tim.foxell’s picture

.

tim.foxell’s picture

Status: Needs work » Needs review
StatusFileSize
new1.21 KB

See attached patch.

alexweber’s picture

Status: Needs review » Reviewed & tested by the community

I was just about to open an issue for this!

Great work, I can confirm it works as advertised!

tim.foxell’s picture

@alexweber,

Yeah it works fine. Chart defaults to "Chart 1" and you have a text field in the visualization settings where you can set the desired title for the chart. I've attached a screenshot of this and also an example of three charts displayed on one page with three different titles. The three charts are all in separate views Attachment displays.

Tim.

alexweber’s picture

@tim.foxell, as a nice added bonus it'd be nice to be able to omit the title altogether. (seems ok with GVA options)

In my particular use case the charts are placed in blocks in a dashboard layout and the block title is doing the job for me ;)

Since this patch is RTBC it might be easier to open this as a follow-up issue though...

tim.foxell’s picture

@alexweber,

There is possibly a more elegant way of doing it, but this gives you the functionality you are looking for.

Tim.

tim.foxell’s picture

Title: Views Style Plugin: Chart Title Option » Views Style Plugin: Chart Title Option fixes
Component: User interface » Code
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new2.74 KB

Included fix for the yAxis title which is now stored and displayed on line and column charts.

tim.foxell’s picture

Title: Views Style Plugin: Chart Title Option fixes » Views Style Plugin: Chart Title and yAxis Title Options and Fixes
Category: feature » bug

@alexweber, do you want to review the latest patch which resolves all comments in this issue? Cheers, Tim.

tim.foxell’s picture

Issue summary: View changes

update description

alexweber’s picture

@tim.foxell, awesome dude, thanks!

Sure, I'll be test this and post back by the end of the day hopefully! :)

tim.foxell’s picture

Assigned: tim.foxell » Unassigned
alexweber’s picture

Status: Needs review » Reviewed & tested by the community

All fixes work as expected! Thanks!

rooby’s picture

Status: Reviewed & tested by the community » Needs work

I think this is still broken.

It should never be using $view->human_name because it is against anything any user has seen in views before.

Every views integration module I've ever seen uses the view display title as the title.
If the display title is empty then there is no title.

Having it use the human_name, which prints even when the display title is not set is counter intuitive.
Then having an extra setting for not showing any title is convoluted.

I will do another pach for comparison.

rooby’s picture

Status: Needs work » Needs review
StatusFileSize
new1.59 KB

Here is a patch that uses the view title for comparison.

Its benefit is that it is a simpler solution but I'm having second thoughts now.

The downside to this patch is that you can't have a different view title to the chart title.

So I'm guessing maybe the previous solution is better because it gives more flexibility.

rooby’s picture

Version: 7.x-1.0-alpha1 » 7.x-1.x-dev
StatusFileSize
new2.95 KB

I've realised the error of my ways, so here's another one.

This one is the patch from 8 with the following changes:
* Exclude title is now show title and it works in reverse as you might expect. This is the same concept as views fields use to show a label.
* The title field is dependent on the show title field (another reason for the previous change), so it hides when it is not relevant.
* Uses $view->get_title() instead of $view->human_name.
* Changes the default title to an empty string.
* Removed an unneeded comma.

This is now my preferred solution.

Opinions?

alexweber’s picture

Awesome!

I like but gonna refrain from RTBC until others get to test as well

rooby’s picture

Here is a version of the patch in #15 that applys over the top of the patch at #1809850-7: Provide more ability to override chart options, for anyone who is using both.

rooby’s picture

Issue summary: View changes

Updated issue summary.

Niremizov’s picture

Issue summary: View changes

Probably the most simple solution is the best? Like in #3?
If user need chart title he would enter it, otherwise there would be no chart title...?

  • Niremizov committed ecebfc7 on 7.x-1.x
    Issue #1908688 by tim.foxell, rooby: Views Style Plugin, Chart Title and...
Niremizov’s picture

Status: Needs review » Fixed

Done here.

Status: Fixed » Closed (fixed)

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