У меня проблемы с отображением графика с данными из mongoDB. Я использую Python, Flask, chartJS и mongoDB
наберитесь терпения, noob здесь
Моя программа:
PYTHON
import pymongo
from datetime import datetime
import html.parser as htmlparser
parser = htmlparser.HTMLParser()
# Mongo connection and Database initialization
myClient = pymongo.MongoClient('mongodb://localhost:27017/')
myDB = myClient['SST']
myCOL = myDB['SSTTemperature']
# Retreave and iterate through the recived document to get all the temperature data
recivedDocument = myCOL.find_one()
temperatureList = recivedDocument['StoragesList'][0]['TemperaturesList']
temperatureListLength = len(temperatureList)
# Save all the Temperature and date and time data in two separated arrays so that i can use them with chartJS
temperatureListData = []
timeListData = []
for everyTemperatureRead in range(temperatureListLength):
temperatureListData.append(temperatureList[everyTemperatureRead]['Temperature']) # Now @tempListData ARRAY contains all the temperature data and ready to be use with chartJS
timeListData.append(temperatureList[everyTemperatureRead]['Date']) # Now @timeListData ARRAY contains all the date and time data and ready to be use with chartJS
print(timeListData)
FLASK
from flask import Flask, render_template, request
import pymongo
import db
unitName = 'CBB-SST-R_1'
app = Flask (__name__)
@app.route('/')
def index():
return render_template("index.html" , SQLdataTime = db.timeListData, SQLdataTemp =db.temperatureListData )
if __name__ == '__main__':
app.run(debug=True)
CMD OUTPUT
['2019-08-16T11:26:52Z', '2019-08-16T11:31:52Z', '2019-08-16T11:36:52Z',....]
ИНСТРУМЕНТ ХРОМА-РАЗРАБОТЧИКА
['2019-08-16T11:26:52Z', '2019-08-16T11:31:52Z', '2019-08-16T11:36:52Z', '2019-08-16T11:41:52Z', '2019-08-16T11:46:52Z', .....]
откуда взялись дополнительные '
?! и как решить эту проблему, когда моя диаграмма пуста?
изображение, чтобы уточнить мой вопрос
Изображение показывает вывод моего приложения