echarts icon indicating copy to clipboard operation
echarts copied to clipboard

Bar chart with time axis doesn't use correct "min" and "max" axis options.

Open Pat-Ibulaire opened this issue 5 years ago • 15 comments

Version

4.9.0

Steps to reproduce

Put the code bellow into Echarts exemple page like https://echarts.apache.org/examples/en/editor.html?c=line-simple

option = {
    yAxis: [
        {
            type: "value"
        },
        {
            gridIndex: 1,
            type: value
        }
    ],
    xAxis: [
        {
            min: 1572883414563,
            max: 1604505814563,
            type: "time"
        },
        {
            min: 1572883414563,
            max: 1604505814563,
            gridIndex: 1,
            type: "time"
        }
    ],
    series: [
        {
            type: "line"
        },
        {
            data: [[1575068400000,89938],[1577746800000,467048]],
            xAxisIndex: 1,
            type: "bar",
            yAxisIndex: 1
        }
    ],
    grid:[{bottom: "54%"},{top: "54%"}],
    dataZoom: [
        {
            realtime: true,
            xAxisIndex: [0,1]
        },
        {
            realtime: true,
            xAxisIndex: [0,1],
            type: "inside"
        }
    ]
}

What is expected?

Min for the two xAxis should be 11-04-2019 (1572883414563 value in option) and Max for the two xAxis should be 11-04-2020 (1604505814563 value in option).

What is actually happening?

Ok for the first xAxis, but not the second. Second axis has 10-22-2019 for Min and 11-18-2020 for Max.


If you set the second series to be type: "line", the problem does not occur. So it may be a problem with bar series...

Pat-Ibulaire avatar Nov 05 '20 09:11 Pat-Ibulaire

Hi! We've received your issue and please be patient to get responded. 🎉 The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to [email protected]. Please attach the issue link if it's a technical question.

If you are interested in the project, you may also subscribe our mailing list.

Have a nice day! 🍵

echarts-bot[bot] avatar Nov 05 '20 09:11 echarts-bot[bot]

capture d'écran_3

Pat-Ibulaire avatar Nov 05 '20 09:11 Pat-Ibulaire

Is there anybody here ? The problem is still present. Thank you

Pat-Ibulaire avatar Jul 30 '21 16:07 Pat-Ibulaire

I'm having the same problem

DaoNguyenTrong avatar Jun 25 '22 02:06 DaoNguyenTrong

Same problem here 😞

kayijyc avatar Sep 01 '22 08:09 kayijyc

Having the same problem. I think this is pretty serious and should be addressed with priority!

ob-ARC avatar Sep 08 '22 10:09 ob-ARC

please also check this example: https://echarts.apache.org/examples/en/editor.html?c=line-simple&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurGAJ4gCmRA5JALZW0A0J6DE0RAjAGwBWAXwAcAZgBMABhky2pWAwCGGXoIEB2PgE4-sue1gr8AGS41iChXgAWwAO5EwAJwCuVeVfQwAWlWfATm5UhgC-nhxcwM4AKhAAxgDWRKhe6Fx4EAAmFgBmSgA2eB6GCoUQAObQAOoQYDYmSgBGVAVB7hFWeCAFdQByrgwtzkQSYZ3dvWBm0BapabYO7SEK4Yac0NEAyj11M3OlpIuOZMHjhsZ4jS1tlla50cpgYP5Eua7Q8ZAwABQAboUOrAuDkMCwyAlEgBKZCwApUMBGAAiSheCFgs3ssBRLx-UIA3MjUVQAHTFMBxJj_QFUAmwZwI1zOOBUeI2JTOMB4EmMUkPZxPH5KHEeWAAIiQAAlJaECEgGAxQmLwS53HS1l5jgBZLjXVrLTrobUqPW3VUlLw2bJUADyf38BSUIGWYRIGtg5Bw-BShgo1DoAIK7lobs8xWcECohFgAG1DPMFH6LLQmhzWId4r1nacOocsqilEQYzH-EJRJJ9FJwTwALrgkvqLS6SvgiQ1mvnBQJ0hJui9WbpryZiDZ82G2D5sCF2MNsviaT6cFiOux0uaHR6RewAAs7dd6Br6BQoXxQA

grafik

vs

grafik

Pretty much unacceptable, no?

ob-ARC avatar Sep 08 '22 10:09 ob-ARC

Some observations:

  • The offset applied to min/max of the axis is dependent on the width of the bars - the smaller the bar width, the smaller the offset.
  • It does not help to extend the axis' min/max to lie well beyond the outermost data points of the bar series (or, vice versa, cut data points close to axis/min max), the offset is still applied.

ob-ARC avatar Sep 08 '22 13:09 ob-ARC

Same problem here

hauserkristof avatar Sep 28 '22 22:09 hauserkristof

I also ran into this problem :(

gehringf avatar Dec 01 '22 12:12 gehringf

@pissang @100pah @Ovilia @plainheart @susiwen8 hey, can you guys help to have a look here? thx

bbcfive avatar Dec 17 '22 10:12 bbcfive

Also following up here. This is causing me a lot of pain and I'm unable to find a solution for sparse datasets shown on time-like bar charts with fairly short intervals (eg a week, with a datapoint on 2 or the days)

jdimmerman avatar May 31 '23 11:05 jdimmerman

I had the same problem. but I don't know why when I set barMaxWidth. just problem solved.

jinbekim avatar Jul 25 '23 05:07 jinbekim

Does this relate to #15671? It is mentioned there that the offset on the axis is added to accommodate bar space on axis limits. Nevertheless, I think the min/max label should still be applied to the actual min/max defined on the axis, and not to the extended, artificial min/max values.

ob-ARC avatar Feb 15 '24 10:02 ob-ARC

I had the same problem. but I don't know why when I set barMaxWidth. just problem solved.

Does not work for me.

ob-ARC avatar Feb 15 '24 10:02 ob-ARC