Welcome Guest Search | Active Topics |

Custom tooltips
cpmbailey
#1 Posted : Friday, March 22, 2013 10:40:22 AM(UTC)
Rank: Member

Groups: ExpiredLicense, Registered
Joined: 3/19/2013(UTC)
Posts: 10

Thanks: 2 times
Was thanked: 0 time(s) in 0 post(s)
Is it possible to have custom tooltips beyond what is capable with a tooltip function? I would like to display some additional information beyond what is available from your standard x, y, series variables. Perhaps by setting a random variable somewhere that can be seen by the function?
Dragan
#2 Posted : Friday, March 22, 2013 1:09:54 PM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
Try using the following code:

Code:
$(document).ready(function () {
            $('#jqChart').jqChart({
                title: 'Hyperlinks',
                animation: { duration: 1 },
                series: [
                            {
                                title: 'Measure',
                                type: 'column',
                                data: [['Google', 70], ['Yahoo', 40], ['Bing', 85]],
                                cursor: 'pointer',
                                customData: ['www.google.com', 'www.yahoo.com', 'www.bing.com']
                            }
                ]
            });

            $('#jqChart').bind('tooltipFormat', function (event, data) {
                var link = data.series.customData[data.index];

                return "<b>" + data.series.title + "</b></br>" +
                       "X = " + data.x + "</br>" +
                       "Y = " + data.y + "</br>" +
                       "My Link - " + link;
            });
        });
Best Regards,
Dragan Matek
jqChart Inc.
1 user thanked Dragan for this useful post.
cpmbailey on 3/22/2013(UTC)
cpmbailey
#3 Posted : Friday, March 22, 2013 1:58:18 PM(UTC)
Rank: Member

Groups: ExpiredLicense, Registered
Joined: 3/19/2013(UTC)
Posts: 10

Thanks: 2 times
Was thanked: 0 time(s) in 0 post(s)
Fabulous..I should have known there would be a custom data in there somewhere :)
Dragan
#4 Posted : Friday, March 22, 2013 2:06:42 PM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
In fact you can name this field whatever you want. For example here it is named "hyperlinks":

http://www.jqchart.com/jquery/chart/ChartFeatures/Hyperlinks

Of course you can add multiple custom data with this way.
Best Regards,
Dragan Matek
jqChart Inc.
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

FlatEarth Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.092 seconds.