Annotations across Horizontal axis

77 views
Skip to first unread message

nateklaiber

unread,
Apr 25, 2012, 2:27:39 PM4/25/12
to Google Visualization API
Here is my scenario:

I have a spreadsheet of data for my vehicle's service and gas records.
Here is a snippet from the CSV:


"Type","MPG","Date","Time","Vehicle","Odometer","Filled Up","Cost/
Gallon","Gallons","Total Cost","Octane","Gas
Brand","Location","Tags","Payment Type","Tire Pressure","Notes","Total
Cost","Services"
"Gas","0.0","2012-04-23","4:52 PM","Mazdaspeed
3","98,891","Full","$3.709","12.106","$44.90","93","BP","25th street,
canton, oh","","BP Visa","32.0","","$44.90",""
"Gas","26.4","2012-04-18","5:15 PM","Mazdaspeed
3","98,572","Full","$2.759","12.113","$33.42","93","BP","Rocky River
BP","","BP Visa","32.0","","$33.42",""
"Gas","0.0","2012-04-15","4:33 PM","Mazda
CX-7","67,326","Reset","$4.079","14.484","$59.08","93","BP","1120 N
Tuscarawas Ave, Dover, OH, 44622","","BP Visa","34.0","","$59.08",""
"Gas","26.7","2012-04-14","3:20 PM","Mazdaspeed
3","98,249","Full","$4.079","12.150","$49.56","93","BP","1120 N
Tuscarawas Ave, Dover, OH, 44622","","BP Visa","32.0","","$49.56",""
"Service","0.0","2012-04-11","8:09 PM","Mazdaspeed
3","98,123","","$0.000","0.000","$388.75","","","3171 S Arlington St,
Akron, OH, 44312","","BP Visa","32.0","Changed spark plugs with stock
replacements, fixed CEL with purge valve replacement","$388.75","Spark
Plugs, Purge Valve Replacement"
"Service","0.0","2012-04-04","6:05 PM","Mazda
CX-7","66,528","","$0.000","0.000","$932.81","","","3171 S Arlington
St, Akron, OH, 44312","","BP Visa","33.0","New tires, alignment, oil
change, and inspection","$932.81","Air Filter, Antifreeze, Inspection,
Oil Change, Rotate Tires, Tire A, Tire B, Tire C, Tire D, Wheel
Alignment"

I want to create a chart with:

1. X-Axis of Miles Per Gallon
2. Y-Axis of either Odometer or Date base (right now I am currently
using Date)

What I would like to do is have my Gas entries as the main data, and
lay the service records over top at a certain Date or Odometer point
(horizontal axis).

I have it working with the annotation and annotationText, and I have:

1. Sorted my dataset by time
2. Grouped by the date (in the cases where there is both a gas entry
and service entry)

There are some cases where there is only a service entry, and
therefore the main data on my line gets skewed because there is no MPG
to report.

I realize I could calculate the difference between the previous/next
fillup - but I figured it would be easier if there was a way to just
lay the annotations over top of the MPG data points (rather than
injecting them in).

Think like Google Analytics - where I can attach an annotation to a
point in time, not to a specific data point on the chart.

Has anyone done anything like this? I have read through the LineChart
docs, as well as the Roles documentation to see how I can set
annotations.

Thanks,
Nate

asgallant

unread,
Apr 25, 2012, 3:41:39 PM4/25/12
to google-visua...@googlegroups.com
You might want to try Domain Axis annotations.  Set up your 'annotation' and 'annotationText' columns after the domain column and setting the annotation.<columnId>.style option to 'line':

annotation: {'column_id': {style: 'line'}} 

Viz Kid

unread,
Apr 30, 2012, 8:31:59 AM4/30/12
to google-visua...@googlegroups.com

Actually, it seems that there is an error in the documentation and this should be the column index and not the column id.

  Viz Kid

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/1NzNV6bwUx8J.

To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

Reply all
Reply to author
Forward
0 new messages