dcc.Store

主要是用来储存json文件的

import dashimport dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Output, Input, State
from dash.exceptions import PreventUpdate# This stylesheet makes the buttons and table pretty.
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']app = dash.Dash(__name__, external_stylesheets=external_stylesheets)app.layout = html.Div([# The memory store reverts to the default on every page refreshdcc.Store(id='memory'),# The local store will take the initial data# only the first time the page is loaded# and keep it until it is cleared.dcc.Store(id='local', storage_type='local'),# Same as the local store but will lose the data# when the browser/tab closes.dcc.Store(id='session', storage_type='session'),html.Table([html.Thead([html.Tr(html.Th('Click to store in:', colSpan="3")),html.Tr([html.Th(html.Button('memory', id='memory-button')),html.Th(html.Button('localStorage', id='local-button')),html.Th(html.Button('sessionStorage', id='session-button'))]),html.Tr([html.Th('Memory clicks'),html.Th('Local clicks'),html.Th('Session clicks')])]),html.Tbody([html.Tr([html.Td(0, id='memory-clicks'),html.Td(0, id='local-clicks'),html.Td(0, id='session-clicks')])])])
])# Create two callback for every store.
for store in ('memory', 'local', 'session'):# Output指向的是dcc.Store# Output指向几个button还有button的'data'# Input是button的n_clicks属性@app.callback(Output(store, 'data'),[Input('{}-button'.format(store), 'n_clicks')],[State(store, 'data')])def on_click(n_clicks, data):# n_clicks来自于Input,data来自于Stateif n_clicks is None:# 如果没有点,数据就不刷新raise PreventUpdate# Give a default data dict with 0 clicks if there's no data.data = data or {'clicks': 0}data['clicks'] = data['clicks'] + 1return data# output the stored clicks in the table cell.@app.callback(Output('{}-clicks'.format(store), 'children'),# Since we use the data prop in an output,# we cannot get the initial data on load with the data prop.# To counter this, you can use the modified_timestamp# as Input and the data as State.# This limitation is due to the initial None callbacks# https://github.com/plotly/dash-renderer/pull/81[Input(store, 'modified_timestamp')],[State(store, 'data')])def on_data(ts, data):if ts is None:raise PreventUpdatedata = data or {}return data.get('clicks', 0)if __name__ == '__main__':app.run_server(debug=True, port=8077, threaded=True)

PlotlyDash中dcc学习相关推荐

  1. 奥卡姆剃刀是什么?机器学习实践中那些学习模型或者那些评估指标践行了这一理论?

    奥卡姆剃刀是什么?机器学习实践中那些学习模型或者那些评估指标践行了这一理论? 奥卡姆剃刀:无无必要,勿增实体. 奥卡姆剃刀原理应用于模型选择时变为以下想法:在所有可能选择的模型中,能够很好地解释已知数 ...

  2. DeepMind发布最新《神经网络中持续学习》综述论文!

    来源:AI科技评论 本文约3200字,建议阅读6分钟 本文重点介绍一些神经网络中最有前途和最有影响力的方向. 在过去的几十年中,人工智能研究取得了巨大进展,但是它主要依赖于固定的数据集和固定的环境. ...

  3. 运动想象脑机接口中迁移学习的完整流程

    点击上面"脑机接口社区"关注我们 更多技术干货第一时间送达 脑机接口(Brain-Computer Interface, BCI)可以让用户使用脑电信号直接与计算机或其他外部设备进 ...

  4. 伍冬睿教授:脑机接口中迁移学习的完整流程

    大家好,今天Rose分享一篇关于脑机接口中的迁移学习的完整流程.本文由华中科技大学伍冬睿教授授权分享. 关于脑机接口中迁移学习方面的研究,伍教授团队做过大量的工作.之前社区分享过<脑机接口中的流 ...

  5. 30多年程序员生涯经验总结(成功源自于失败中的学习;失败则是因为容忍错误的横行)...

    英文原文:Lessons From A Lifetime Of Being A Programmer 在我 30 多年的程序员生涯里,我学到了不少有用的东西.下面是我这些年积累的经验精华.我常常想,如 ...

  6. 函数式编程基础_在收件箱中免费学习函数式编程的基础

    函数式编程基础 by Preethi Kasireddy 通过Preethi Kasireddy 在收件箱中免费学习函数式编程的基础 (Learn the fundamentals of functi ...

  7. 前端中什么是中台开发环境_Web前端开发中需要学习什么?会使用到哪些开发工具?...

    今天我们来谈谈Web和前端开发过程中需要学习什么?前端开发需要使用什么开发工具?也简单介绍前端开发前景和薪水.下面和千锋广州小编一起来看看吧! ​前端工程师的主要职责: 前端工程师在不同的公司有不同的 ...

  8. @excel 注解_Java中注解学习系列教程-3

    本文是<Java中注解学习系列教程>第三篇文章 在前两篇中我们学习了注解的定义.JDK内置注解.注解分类及自定义注解的写法. 本文咱们将学习: ​ 1:自定义注解一些说明 2:自定义注解怎 ...

  9. DeepMind发布《神经网络中持续学习》Cell综述论文

    点上方计算机视觉联盟获取更多干货 仅作学术分享,不代表本公众号立场,侵权联系删除 转载于:专知 AI博士笔记系列推荐 周志华<机器学习>手推笔记正式开源!可打印版本附pdf下载链接 现代机 ...

最新文章

  1. 从一道面试题分析Thread.interrupt方法
  2. 大数据实战之环境搭建(八)
  3. zzuli oj 1167逆转数(指针专题)
  4. kvm.huge页、常用命令和桥接设置
  5. 标准成本、目标成本、实际成本
  6. mysql 查询从库状态_Mysql库表状态查询
  7. Qt新添加的类无法链接
  8. 【用jQuery来判断浏览器的类型】及【javascript获取用户ip地址】
  9. linux 如何重启apache
  10. 如何才能打造一个良好的Java功底,提高自己的核心竞争力?
  11. java hashmap 无序_Map的有序和无序实现类,与Map的排序
  12. Asp.net core 学习笔记 ( OData )
  13. ubuntu截图快捷方式
  14. 详细分析Java8中default关键字
  15. 大象知道“故事怎么讲”
  16. mongo-java 实现使用and拼接多个or查询条件
  17. AD19 编译报错:has only one pin 和 floating net label
  18. 信捷触摸屏UI模板XINJIE UI信捷触摸屏界面模板
  19. 存储过程,查询结果赋值给定义变量
  20. STM32——OLED显示实验

热门文章

  1. 老嘤学习笔记——python函数
  2. jq animate动画详解
  3. DisplayPort接口全总结
  4. 深度学习的不确定性(Uncertainty/confidence score)与校准(Calibration)
  5. 这可能是最好的firefox移动版翻译插件
  6. 边缘计算在自动驾驶中的应用场景丨边缘计算阅读周
  7. 第十六周上机实践—项目2—大数据集上排序算法性能的体验
  8. 一周热图|比尔·盖茨在北京展示电子药盒;灯光艺术节点亮上海;陈飞宇、赖冠霖助力欧莱雅...
  9. 一汽大众迈腾车前悬架系统设计
  10. 旭荣管理软件怎么修改小票内容_【好工具】强烈安利的文献管理软件 Mendeley