首页 > 解决方案 > 如何更改破折号大小?

问题描述

我有一个小尺寸的破折号 如何更改破折号大小或父 div 大小?我使用了示例中的简单用法,它工作正常。但我对新破折号有尺寸问题

[enter image description here][1]

破折号应用

 import dash 
 import dash_core_components as dcc
 import dash_html_components as html

from django_plotly_dash import DjangoDash

app = DjangoDash('SimpleExample')   # replaces dash.Dash

app.layout = html.Div(children=[
html.H1(children='Hello Dash'),

html.Div(children='''
    Dash: A web application framework for Python.
'''),

dcc.Graph(
    id='example-graph',
    figure={
        'data': [
            {'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
            {'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
        ],
        'layout': {
            'title': 'Dash Data Visualization'
        }
    }
)])  if __name__ == '__main__':
app.run_server(debug=True)

视图.py

from django.shortcuts import render
from django.http import HttpResponse
from . import plotly_app



 def index(request):
     return render(request, "index.html")

一些重要的设置

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'newtry',
'django_plotly_dash.apps.DjangoPlotlyDashConfig',]

父 div 的默认大小为 0。我使用了很多图表,大小为 0。我认为这可能取决于简单的使用大小形式。但我无法改变这一点

<div style="
    position: relative;
    padding-bottom: 10.0%;
    height: 0;
    overflow:hidden;
    ">
  <iframe src="/django_plotly_dash/app/SimpleExample/" style="
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    " frameborder="0"></iframe>
</div>

标签: pythondjangoplotly-dash

解决方案


推荐阅读