나는 Dashing이라는 Sinatra 기반 프레임 워크를 사용하여 프로젝트 작업을하고 있습니다. 내 프로젝트의 일부는 RickShaw Graph를 사용하여 그래프를 작성하는 것입니다. 내 문제는 X 축에 월 이름과 날짜를 표시 할 수 없다는 것입니다. 나는 이러한 값을 표현하기 위해 coffeescript를 사용하고 있습니다. 내가 여기에 사용할 수있는 인력거 그래프 API 이해 것과Coffeescript의 Rickshaw Graph에 월 이름을 표시 할 수 없습니다.
class Dashing.Graph extends Dashing.Widget
@accessor 'points', Dashing.AnimatedValue
@accessor 'current', ->
return @get('displayedValue') if @get('displayedValue')
points = @get('points')
if points
points[points.length - 1].y
#ready is triggered when ever the page is loaded.
ready: ->
container = $(@node).parent()
# Gross hacks. Let's fix this.
width = (Dashing.widget_base_dimensions[0] * container.data("sizex")) + Dashing.widget_margins[0] * 2 * (container.data("sizex") - 1)
height = (Dashing.widget_base_dimensions[1] * container.data("sizey"))
@graph = new Rickshaw.Graph(
element: @node
width: width
height: height
renderer: @get("graphtype")
series: [
{
color: "#fff",
data: [{x:0, y:0}]
}
]
)
@graph.series[0].data = @get('points') if @get('points')
time = new Rickshaw.Fixtures.Time()
days = time.unit("day")
x_axis = new Rickshaw.Graph.Axis.Time(
graph: @graph
timeUnit: days
)
y_axis = new Rickshaw.Graph.Axis.Y(graph: @graph, tickFormat: Rickshaw.Fixtures.Number.formatKMBT)
@graph.render()
:
https://github.com/shutterstock/rickshaw/blob/master/src/js/Rickshaw.Fixtures.Time.js
당신이 장치의 이름을 지정할 수 있다고 여기 그래프에 대한 코드입니다. 그래서이 인스턴스에 대해서는 테스트 목적으로 "하루"를 사용했지만이 기능은 작동하지 않는 것 같습니다. 도움이 될 것입니다.
감사합니다, 나는 문제가 업데이트되었습니다 나는이 Rickshaw.min.js 파일을 업데이트하지 않았다고 생각. 이전 버전에는 Time.Local이 없습니다. 최신 버전을 원하는 사람이라면 https://raw.github.com/shutterstock/rickshaw/master/rickshaw.min.js에서 다운로드 할 수 있습니다. – Joshi