Skip to content

Latest commit

 

History

History
22 lines (13 loc) · 1.48 KB

File metadata and controls

22 lines (13 loc) · 1.48 KB

Graph View Demo

GraphViewDemo

This app shows the evolution of writing a custom view by creating a graph view that takes in an array of floats and draws either a line or bar graph. The graph view also accepts touch inputs and draws a pointer with animations.

Each GraphView builds off of the previous one.

Steps:

  1. GraphView - overrides onDraw to draw two lines to make the axes of the graph
  2. GraphView2 - adds public setData method and uses a Path object to draw the line graph
  3. GraphView3 - overrides onTouchEvent and draws a pointer for where the user is touching
  4. GraphView4 - adds animation with ValueAnimator to animate the pointer when a user touches the graph
  5. GraphView5 - adds custom attributes to control the graph view in xml and adds a bar type graph that can be selected with custom attribute

Created for a talk given at the OC Android Developer Meetup group.

Slides for this talk can be found here.