cal-heatmap

Using JS library installed via npm in Typescript Angular 2 project

China☆狼群 提交于 2019-12-08 12:44:08
问题 I don't manage to use cal-heatmap in my Angular2 project written in TypeScript. Any help on how to get this going would be appreciated. I am using webpack (webpack.config.js) to bundle the application. Here is the ts.config. I installed cal-heatmap with npm and type definitions with tsd. In my application's TypeScript code I would do like: import * as calheatmap from 'cal-heatmap'; However, when I open the application in a browser calheatmap remains undefined and nothing is imported. The

Django: passing JSON from view to template

雨燕双飞 提交于 2019-12-03 17:35:30
问题 In views.py , I have time series data stored in a dictionary as follows: time_series = {"timestamp1": occurrences, "timestamp2": occurrences} where each timestamp is in unix time and occurrences is an integer. Is there a way to pass the time series data as a json object in the context of the render function? Why do this: I am using Cal-heatmap on the front end which requires the data to be in json format. Ajax requests work just fine for now but I ideally would like to use the render approach

Django: passing JSON from view to template

空扰寡人 提交于 2019-11-30 09:22:23
In views.py , I have time series data stored in a dictionary as follows: time_series = {"timestamp1": occurrences, "timestamp2": occurrences} where each timestamp is in unix time and occurrences is an integer. Is there a way to pass the time series data as a json object in the context of the render function? Why do this: I am using Cal-heatmap on the front end which requires the data to be in json format. Ajax requests work just fine for now but I ideally would like to use the render approach if possible. If a frontend library needs a to parse JSON, you can use the json library to convert a