Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/scala/BTreeChart.scala
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ case class ChartParameters(width: Int, height: Int, xMin: Long, xMax: Long, yMin
def xValToPos(value: Long): Double = (value - xMin) * xScale
def xPosToVal(pos: Double): Long = (pos / xScale).toLong + xMin
def yValToPos(value: Double): Double = (yMax - value) * yScale
def yPosToVal(pos: Double): Double = yMax - (pos / yScale)

// TODO is this the right place for these functions to live?
def timestampFromDateTime(dateTime: ZonedDateTime): Long = {
Expand Down
17 changes: 16 additions & 1 deletion src/main/scala/GridCanvas.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ class GridCanvas extends ResizableCanvas {
gc.restore()
}


protected def drawValueLines(gc: GraphicsContext, scale: ChartParameters): Unit = {
gc.save()
gc.setStroke(gc.getStroke.asInstanceOf[Color].deriveColor(0, 1, 1, GRIDLINE_ALPHA))
gc.setLineWidth(CONTEXT_GRIDLINE_WIDTH)
val v_interval = List.range(0,scale.height,64)
v_interval.foreach{ value =>
gc.strokeLine(0,value,scale.width,value)
// println(s"DEBUG: value: $value")
RenderHelper.drawContrastText(gc, ChartCommon.CONTRAST_BACKGROUND, ((scale.yPosToVal(value) * 100).round / 100.toDouble).toString,
20, value)
}
gc.restore()
}

protected def drawRulers(gc: GraphicsContext, scale: ChartParameters,
priorContextTime: ZonedDateTime,
tickTimes: Seq[ZonedDateTime], contextTimes: Seq[ZonedDateTime]): Unit = {
Expand Down Expand Up @@ -86,6 +101,6 @@ class GridCanvas extends ResizableCanvas {

drawGridlines(gc, scale, tickTimes, contextTimes)
drawRulers(gc, scale, priorContextTime, tickTimes, contextTimes)

drawValueLines(gc,scale)
}
}