This is a migrated thread and some comments may be shown as answers.

Help working with field and categoryField for tootips

2 Answers 12 Views
Charts
This is a migrated thread and some comments may be shown as answers.
IT Purchasing
Top achievements
Rank 1
IT Purchasing asked on 17 Dec 2013, 12:29 AM
Below is a little snippet of JS from my code.  I understand how categoryField and field work and how the tootip templates work.  I even know how to format the "value" in the template.  The problem is I create these charts dynamically, and I don't know it if it integer, real, currency or percentage coming back.

I looked through the docs with no luck, but want to fine something like this
categoryField: "Category",
field: "Value",
fieldDisplay: "ValueFormatted",
Where the fieldDisplay is the formatted result and use something like this:
template: "${category} ${valueDisplay} - Prior Period"
Some Examples

field: 12345.12
fieldDisplay: $12,345.12
OR
field: .678989778
fieldDisplay: 68.9%

Is there a way to do this?
, series: [{
    name: "Prior Period",
    overlay: { gradient: "none" },
    categoryField: "Category",
    field: "Value",
    tooltip: {
        visible: true,
        template: "${category} ${value} - Prior Period"
    },
    data: jsonPrior
}, {
    name: $('#lblDateRange').html(),
    overlay: { gradient: "none" },
    categoryField: "Category",
    field: "Value",
    tooltip: {
        visible: true,
        template: "${category} ${value} - " + $('#lblDateRange').html()
    },
    data: jsonData
}]


2 Answers, 1 is accepted

Sort by
0
Accepted
Hristo Germanov
Telerik team
answered on 18 Dec 2013, 12:12 PM
Hello IT Purchasing,

If your your dateItem contain this property you can display it easily with:
template: "${category} ${dataItem.valueDisplay} - Prior Period"

For more information you can examine our online api reference documentation.

Regards,
Hristo Germanov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
IT Purchasing
Top achievements
Rank 1
answered on 18 Dec 2013, 04:51 PM
That worked like a charm.  I overlooked the dataItem in the template documenation.
Tags
Charts
Asked by
IT Purchasing
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
IT Purchasing
Top achievements
Rank 1
Share this question
or