使用ChartbuilderDispatcher加载外部数据

时间:2017-04-07 19:13:56

标签: javascript jquery json charts

使用Chartbuilder 3.x并尝试创建加载外部对象以构建图表的功能。目前存在一种功能,当您重新加载页面时,会出现一个按钮,显示"重新加载以前的数据"。它使用localStorage对象。

然而,加载数据的函数是匿名的。

希望创建一个按钮,以基于本地JSON对象而不是localStorage对象加载指定版本的图表。

该图表使用此功能,但正如我所说,它在运行时是匿名的,所以我无法通过consolhttp://quartz.github.io/Chartbuilder/api-docs/#ChartbuilderDispatcher

进行测试

目前的电话是: import tensorflow as tf x_train = [1, 2, 3] y_train = [1, 2, 3] X = tf.placeholder(tf.float32) Y = tf.placeholder(tf.float32) W = tf.Variable(5.) b = tf.Variable(5.) hypothesis = X * W + b cost = tf.reduce_mean(tf.square(hypothesis - Y)) learning_rate = 0.1 W_gradient = tf.reduce_mean((W * X + b - Y) * X) * 2 b_gradient = tf.reduce_mean(W * X + b - Y) * 2 W_descent = W - learning_rate * W_gradient b_descent = b - learning_rate * b_gradient W_update = tf.assign(W, W_descent) b_update = tf.assign(b, b_descent) sess = tf.Session() sess.run(tf.global_variables_initializer()) for step in range(21): cost_val, W_gradient_val, W_update_val, b_gradient_val, b_update_val = sess.run( [cost, W_gradient, W_update, b_gradient, b_update], feed_dict={X: x_train, Y: y_train}) print("%3d Cost: %8s, W': %8s, W: %8s, b': %8s, b: %8s" % (step, round(cost_val, 5), round(W_gradient_val * learning_rate, 5), round(W_update_val, 5), round(b_gradient_val * learning_rate, 5), round(b_update_val, 5)))

应用程序已经在存储状态方面做得很好,但我希望能够添加功能或替换它。

0 个答案:

没有答案
相关问题