Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以在 HTML5 中使用 Filereader 将 CSV 数据文件拖放到 Dygraph 画布上吗?现在,我将文件名(或包含文件名的 JS 变量)硬编码到“new Dygraph()”分配中。
当然!主要区别在于 FileReader 读取客户端机器上的文件。传递给 dygraphs 构造函数的 JS 变量是服务器上的文件名。
您可以将 CSV 数据而不是文件名传递给 dygraphs 构造函数。您应该使用 FileReader 从用户拖放的文件中读取 CSV 数据。然后使用该数据构造一个 Dygraph 对象。