내 django 프로젝트에서 다음 뷰를가집니다.Django의 NVD3 차트 - 호출시 응답하지 않는 웹 페이지
def ChartView(request):
connection = SQLSeverConnection('MSSQLServerDataSource')
times = connection.getColumnData('DateTimeStamp', 'reqColumn', '2011-01-01 00:00:00.000', '2011-01-21 19:30:00.000')
string_times = []
for theTime in times:
string_times.append(theTime.DateTimeStamp)
start = string_times[0]
end = string_times[-1]
start_time = int(time.mktime(start.timetuple()))
end_time = int(time.mktime(end.timetuple()))
xdata = range(start_time, end_time, 1)
xdata = map(lambda x: start_time + x * 1000000000, xdata)
ydata = connection.getColumnData('AIKE0G_1_MVAr', 'DunbarGen', '2011-01-01 00:00:00.000', '2011-01-21 19:30:00.000')
tooltip_date = "%d %b %Y %H:%M:%S %p"
extra_serie = {"tooltip": {"y_start": "Value was ", "y_end": " units"},
"date_format": tooltip_date}
chartdata = {
'x': xdata,
'name1': 'series 1', 'y1': ydata, 'extra1': extra_serie,
}
charttype = "lineWithFocusChart"
chartcontainer = 'linewithfocuschart_container' # container name
data = {
'charttype': charttype,
'chartdata': chartdata,
'chartcontainer': chartcontainer,
'extra': {
'x_is_date': True,
'x_axis_format': '%d %b %Y %H',
'tag_script_js': True,
'jquery_on_ready': True,
}
}
pdb.set_trace()
return render_to_response('chart_view.html', data)
에 오류가 없습니다 (즉, 500 페이지로 이어질 것입니다)하지만 이동이 페이지를 결코 chart_view 없음로드합니다. .getColumnData() 반환 객체의
유형은 내가 성공적으로
는은 아무도 도울 수 (나는 날짜에 대한 nvd3 해석을한다고 가정)를 int로 바뀌 가지고 pyodbc.row입니까? 이것은 nvd3을 사용하는 좋은 방법입니까? 더 좋은 방법이 있다면 예를 들어 주면 매우 감사 할 것입니다.
템플릿;
{% load nvd3_tags %}
<head>
{% include_chart_jscss %}
{# Jquery CDN : Needed when using jquery_on_ready=True #}
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
{% load_chart charttype chartdata chartcontainer extra %}
</head>
<body>
{% include_container chartcontainer 400 '100%' %}
</body>
감사!
chart_view.html을 표시 할 수 있습니까? 또한 브라우저 콘솔에 몇 가지 오류가있을 수 있습니까? –
거기 가서! 원래 게시물의 기슭에 –
템플릿 좋습니다. 브라우저 콘솔에서 오류를 확인 했습니까? –