Code Monkey home page Code Monkey logo

Comments (6)

mswastik avatar mswastik commented on May 29, 2024

image
I see the div id 'c10' created correctly under row element id c7 but it is not displayed in browser. When the div id c10 is not under c7, chart is displayed in the browser.

EDIT: This is due to default height & width of echart when displaying under a container element. I provided min-width & min-height to row element, now I can see the chart.

r1=ui.row().style('min-height:250px;min-width:450px')
with r1:
    ec=ui.echart({'xAxis':{},'yAxis': {},'series': [{'type': 'line', 'data': []},{'type': 'line', 'data': [1,2,3]}]}).style('height:250px;width:650px')

from nicegui.

falkoschindler avatar falkoschindler commented on May 29, 2024

Hi @mswastik, thanks for bringing this up!

We also had problems with ECharts in flexboxes like ui.row. It might be related to apache/echarts#11791, but I'm not sure. So far I couldn't come up with a simple workaround.

If anyone has an idea how to work around or fix this problem, we're all ears!

from nicegui.

mswastik avatar mswastik commented on May 29, 2024

I was able to view echart by manually specifying row min-height & min-width as mentioned above.

from nicegui.

falkoschindler avatar falkoschindler commented on May 29, 2024

@mswastik Yes, that might work in certain cases. But as soon as you add a second chart, they resize strangely when resizing the browser window.

from nicegui.

mswastik avatar mswastik commented on May 29, 2024

ok, maybe you can try experimenting with tailwind classes as a workaround.

from nicegui.

falkoschindler avatar falkoschindler commented on May 29, 2024

I think I finally understand the original problem:

  • ui.echart comes with "width: 100%" by default. That means it gets the width from its parent container.
  • ui.row is a flexbox with an undefined width.
  • Because the nested ui.echart has a minimum width of 0, the ui.row shrinks to this size.

To avoid this problem, you can either set a width or minimum width on the ui.echart or on the ui.row:

with ui.row().classes('w-full'):
    ui.echart({'xAxis': {}, 'yAxis': {}, 'series': [{'type': 'line', 'data': [1, 2, 3]}]})

from nicegui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.