Skip to content

Rounding issue on Y Axis #372

@KlausSchaefers

Description

@KlausSchaefers

Expected Behaviour

Labels are rounded on Y-Axis

Actual Behaviour

Sometimes weird rounding errors appear, e.g. 3.00000004 instead of 3

Steps to Reproduce:

let data = {
  "labels": [
    16,
    17,
    18,
    19,
    20,
    21,
    22,
    23,
    0,
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    12,
    13,
    14,
    15,
    16
  ],
  "datasets": [
    {
      "name": "ProcessCpuLoad",
      "type": "line",
      "values": [
        0.0010851372003041857,
        0.008908770001378012,
        0.0016433712387663034,
        0.00119334458632085,
        0.0011110273819379232,
        0.0013080890802622922,
        0.000793723689910099,
        0.0008262451648681351,
        0.0008002227881507173,
        0.0006110313866714872,
        0.0007236763702570661,
        0.0007511408732358443,
        0.0007759956986312113,
        0.0006793163443483884,
        0.0004687053987042527,
        0.00053408784143433,
        0.000555029990952316,
        0.0006040740667298584,
        0.001139243198795388,
        0.0013669765634971495,
        0.0028501640242460965,
        0.0025931079872774545,
        0.0015741984167879713,
        0.0009920540876301514,
        0.0007873962723498006
      ]
    },
    {
      "name": "SystemCpuLoad",
      "type": "line",
      "values": [
        0.02003709888105015,
        0.022480680333165293,
        0.037120440655129046,
        0.015499604183329066,
        0.018572353415679515,
        0.007769093815095734,
        0.007295836243567131,
        0.007030814591940904,
        0.007641089446255603,
        0.005845656764419566,
        0.007766033377201927,
        0.010782076086438837,
        0.008932869055664644,
        0.007174909190052844,
        0.006199536489996573,
        0.007074913422611202,
        0.007316888470491944,
        0.00790422458798326,
        0.02654765784193138,
        0.020530105852443793,
        0.04003671857553161,
        0.05642053221342041,
        0.021324168076959242,
        0.011142706711297261,
        0.0074260770057756826
      ]
    },
    {
      "name": "SystemLoadAverage",
      "type": "line",
      "values": [
        0.14023809523809522,
        0.1991666666666666,
        0.31783333333333336,
        0.14366666666666666,
        0.12549999999999994,
        0.06633333333333331,
        0.020333333333333335,
        0.05749999999999998,
        0.06449999999999997,
        0.036166666666666666,
        0.06833333333333334,
        0.06883333333333332,
        0.09733333333333336,
        0.037333333333333336,
        0.05416666666666666,
        0.05516666666666667,
        0.05716666666666663,
        0.07683333333333332,
        0.1569999999999999,
        0.16216666666666668,
        0.3044067796610171,
        0.4420000000000001,
        0.21033333333333334,
        0.07933333333333333,
        0.05666666666666667
      ]
    }
  ]
}

 new Chart(this.$refs.cpuChart, { 
            data: data,
            type: 'line', // or 'bar', 'line', 'scatter', 'pie', 'percentage'
            height: this.chartHeight,
            colors: this.chartColors
        })

NOTE:
FrappeChartBug

Frappé Charts version: 1.6.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions