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

Adding a Tooltip with X and Y values in the ToolTip Text

1 Answer 213 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 2
Ian asked on 22 Jul 2013, 06:29 PM
I have a chart that displays a tooltip with the value. I need it to also display the date associated with the value.

This is financial data, so I need it to show in the tool tip "34,000 at Mar 31" not just "31,000" as it does now.

Here's my chart:

Html.Kendo().Chart<AccountPerformance>(Model.Results)
    .Name("chartMKT")
    .Title("Market Value")
    .Legend(legend => legend.Visible(false))
    .Series(series =>
            series.Line(model => model.Metrics.MarketValue)
                  .Name(Model.ColumnTitle)
                  .Labels(false)
    )
    .ValueAxis(axis => axis
        .Numeric()
        .Labels(labels => labels.Format("{0:C0}")))
    .CategoryAxis(axis => axis
        .Date()
        .MajorGridLines(builder => builder.Visible(false))
        .Categories(model => model.MarketDate)
        .Labels(labels => labels.Format(mktValFormatter)
        .Rotation(mrkValRotation)))
    .SeriesDefaults(builder => builder.Line().Color("#005984"))
    .Tooltip(tooltip => tooltip
          .Visible(true)
          .Format("{0:C}")
          .Color("white")
          .Background("black")
          .Template("#= value #")
    )
     .Render();

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 23 Jul 2013, 12:17 PM
Hello Ian,

In order to achieve this you could set and the category at the tooltip.template. For example:  

Html.Kendo().Chart<AccountPerformance>(Model.Results)
  .Name("chartMKT")
  //....
  .Tooltip(tooltip => tooltip
     //....
     .Template("#=kendo.format('{0:C}', value)# at #=category#")
)
Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Ian
Top achievements
Rank 2
Answers by
Iliana Dyankova
Telerik team
Share this question
or