Welcome Guest Search | Active Topics |

I can not display the labels in JQChart?
skystar
#1 Posted : Friday, October 17, 2014 4:24:54 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/17/2014(UTC)
Posts: 6

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Help, how to get a pie chart title triangles instead of percentages. The documentation for this example, considered very fast, without using text instead of numbers.

I have a code:

$('#jqChart').jqChart({
legend: { visible: false },
animation: { duration: 1 },
series: [
{
type: 'pie',
fillStyles: ['#418CF0', '#FCB441', '#E0400A', '#056492', '#BFBFBF'],
labels: {
stringFormat: '%s',
valueType: 'dataValue',
font: '15px sans-serif',
fillStyle: 'white'
},
data: [['N', 65], ['A', 58], ['B', 30],
['F', 60], ['C', 65]]
}
]
});
I have the image, there is enough show that I want to change. http://i57.tinypic.com/158babt.jpg

I have tried many options, changing stringFormat, but unfortunately it does not work. What am I doing wrong, thanks for your help.
Dragan
#2 Posted : Friday, October 17, 2014 5:14:24 AM(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)
Hi,

You can use 'dataPointLabelCreating' event to customize the labels:
http://www.jqchart.com/jquery/chart/CustomizingChart/DataPointLabelCreatingEvent

In your case the code should looks like:
Code:
$('#jqChart').bind('dataPointLabelCreating', function (event, data) {
                data.text = data.context.dataItem[0];
            });


            $('#jqChart').jqChart({
                legend: { visible: false },
                animation: { duration: 1 },
                series: [
                    {
                        type: 'pie',
                        fillStyles: ['#418CF0', '#FCB441', '#E0400A', '#056492', '#BFBFBF'],
                        labels: {
                            stringFormat: '%s',
                            valueType: 'dataValue',
                            font: '15px sans-serif',
                            fillStyle: 'white'
                        },
                        data: [['N', 65], ['A', 58], ['B', 30],
                        ['F', 60], ['C', 65]]
                    }
                ]
            });
Best Regards,
Dragan Matek
jqChart Inc.
skystar
#3 Posted : Friday, October 17, 2014 5:18:58 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/17/2014(UTC)
Posts: 6

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Great thanks! It works!
Users browsing this topic
Guest
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.198 seconds.