Home › Forums › Chart Support › Format “onmouseover” Text

Format “onmouseover” Text

Viewing 4 posts - 1 through 4 (of 4 total)
  • #29734

    Hi all!

    I just can’t figure out how to format the values.
    I’d prefer time instead of date or both and I’d like to round the temperature values.
    13,8 would be accurate enough ;)
    Screenshot

    Thx for help!

    • This topic was modified 6 years, 3 months ago by Epinephrine.
    • This topic was modified 6 years, 3 months ago by Epinephrine.
    #29748

    @epinephrine,

    You can format the x and y-values being shown in toolTip by setting the xValueFormatString and yValueFormatString respectively, as per your requirement.

    If you are still facing the issue, kindly create a JSFiddle reproducing the issue you are facing and share it with us so that we can look into the code, understand the scenario better and help you out.

    —
    Shashi Ranjan
    Team CanvasJS

    #29756

    I’m not sure if it is the “best practice” but I was able to solve my problem via
    toolTip:{
    contentFormatter: function ( e ) {
    var content = \” \”;
    for (var i = 0; i < e.entries.length; i++) {
    content += e.entries[i].dataSeries.name + \”<br/>Datum: \” +(new
    Date(e.entries[i].dataPoint.x)).toLocaleString(\”de-DE\”) + \”<br/>Wert: \”
    +(Math.round((e.entries[i].dataPoint.y)*100)/100);
    content += \”<br/>\”;
    }
    return content;

    Additiional chars due to embedded into PHP

    #29768

    @epinephrine,

    xValueFormatString and yValueFormatString properties can be used to format the respective x and y-values being shown in toolTip & indexLabel. However, to customize the complete content as per your requirement you can use toolTip contentFormatter function.

    —
    Shashi Ranjan
    Team CanvasJS

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.