나의 요구 사항은 cherrypy와 matplotlib가있는 웹 페이지에 막대 그래프 하나를 그려 보는 것입니다. 그래프를로드 할 수 있지만 위의 좌표는 onmouseover 입니다. 아무도 내가 어떻게 좌표를 얻을 수 제안 할 수 있습니다. 내가 자바 스크립트를 사용하거나 Matplotlib 요구 사항을 수행 할 수 있습니다. 코드는이Matplotlib Python
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
class HelloWorld:
def index(self):
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot([1,2,3])
fig.savefig('test.png')
return ''' <img src="test.png" width="640" height="480" border="0" /> '''
index.exposed = True
import os.path
tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf')
if __name__ == '__main__':
cherrypy.quickstart(HelloWorld(), config=tutconf)
else:
cherrypy.tree.mount(HelloWorld(), config=tutconf)
인터랙티브 차트를 작성하면서 Python 코드를 사용하려면 [plotly] (https://plot.ly/matplotlib/) 및 해당 matplotlib 통합을 살펴보십시오. – saaj