如何从嵌入Raphael数据集中提取数据到CSV? [英] How to extract data from an embed Raphael dataset to CSV?

查看:241
本文介绍了如何从嵌入Raphael数据集中提取数据到CSV?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从此。



现在,每个候选人都有大量的数据。我不知道这些数字是什么关系,但他们肯定是用于他们在图表中的计算。我发现 main.js 在392行,用这个表达式计算数据:

  Math.log(dataPoints [ i] [j] * 100.0)/ Math.log(logScaleBase); 

我的猜测是:没有对数和一个指数计算,你应该得到正确的结果。 p>

Attempting to extract the data from this Google Politics Insights webpage from "Jan-2012 to the Present" for Mitt Romney and Barack Obama for the following datasets:

  • Search Trends Based on volume
  • Google News Mentions Mentions in articles and blog posts
  • YouTube Video Views Views from candidate channels

For visual example, here's what I mean:

Using Firebug I was able to figure out the data is stored in a format readable by Raphael 2.1.0; looked at the dataset and nothing strikes me as a simple way to convert the data to CSV.

How do I convert the data per chart per presidential candidate into a CSV that has a table for "Search Trends", "Google News Mentions", and "YouTube Video Views" broken down by the smallest increment of time with the results measured in the graph are set to a value of "0.0 to 1.0"? (Note: The reason for "0.0 to 1.0" is the graphs do not appear to give volume info, so the volume is relative to the height of the graph itself.)

Alternatively, if there's another source for all three datasets in CSV, that would work too.

解决方案

First thing to do is to find out where the data comes from, so I looked up the network traffic in my developer console, and found it very soon: The data is stored as json here.

Now you've got plenty of data for each candidate. I don't know exactly in what relation these numbers are but they definitely are used for their calulation in the graph. I found out that the position in the main.js is on line 392 where they calculate the data with this expression:

Math.log(dataPoints[i][j] * 100.0) / Math.log(logScaleBase);

My guess is: Without the logarithm and a bit exponential calculation you should get the right results.

这篇关于如何从嵌入Raphael数据集中提取数据到CSV?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆