Start with Table 12 on page 12 of the data sheet.
Read the Configuration register B to determine the Gain bits for looking up in Table 12.
The Gain column of Table 12 is in Counts per milli-Gauss.
So if the Gain setting is 001 (default) the Gain is 1300 counts/mGauss.
With axis readings of: x=-298, y= 143, z=-245.
Reading divided by Gain = Magnetic strength
-298/1300 = -0.229
143/1300 = 0.11
-245/1300 = -0.188
These really don't make sense since the Earth's field strength is between 0.3 to 0.6 Gauss at the surface.
It looks as if the units are in error and the Gain column is counts/Gauss not milli-Gauss.
The vector sum of the three above is 0.316 Gauss which a reasonable value. But assumes that the Gain is at the Default value.
Note that these values are subject to the error tolerance and non-linearity per the specs on page 2.
Edit: Just re-read your question. The answer above is to calculate the actual magnetic strength from the readings whereas you wish to calculate the magnetic field vector heading.
This just requires some trig (
http://en.wikipedia.org/wiki/Trigonometric_functions) so with a sample reading of: x=-298, y= 143, z=-245.
These are the magnetic strength vectors for each axis in three dimensions. On a 2D Cartesian graph (
http://en.wikipedia.org/wiki/Cartesian_ ... ate_system) plot a point for x and y and draw a line from the point to the origin. The angle of this line to the x-axis is related by the Tangent, tan angle = y/x. So the angle = arctan (y/x). arctan( 143/-298) = -25° (as calculated by Excel's ATAN function).
Now is the hard part. What does -25° mean and is this really correct. When you plotted the point (-298, 143) the point is in the upper left quadrant (quad II). The ATAN function I used returns an angle between -180° and +180° (-PI/2 to PI/2 Radians). An angle of zero degrees is the positive x-axis (x = pos, y = 0). Also if the values were x = 289, y = -143 (lower left quad) the ATAN function would return the same angle of -25°. This means that you must figure out which quadrant the vector is in and then adjust the angle by 0, 180 or -180°.
Can you take it from here?