I believe the answer is continuous but I maybe incorrect. Below is my
latest code, no data. The data from a JSON request but maybe you can get
an idea of what I am doing.
drawChart(id: number, name: string, isMetric: boolean = false): void {
"use strict";
/// Get data from server
$.getJSON("/Api/PtPSiteData/" + id, function (data: any): void {
/// distance string
var hLabel: string = (isMetric ? "km" : "miles");
var vLabel: string = (isMetric ? "meters" : "feet");
var txLabel: string = data.report.TXSiteName;
var rxLabel: string = data.report.RXSiteName;
/// Build the chart data table
/*
* report
* Reference
* Profile
* Curvature
* Fresnal
* Fresnal60
*/
var table: google.visualization.DataTable = new
google.visualization.DataTable();
table.addColumn("number", "x", "x");
table.addColumn("number", "Point-to-Point Profile", "Profile");
table.addColumn("number", "Line of Sight Path", "Reference");
table.addColumn("number", "First Fresnel Zone", "Fresnal");
table.addColumn("number", "60% of First Fresnel Zone", "Fresnal60");
table.addColumn({ type: "string", role: "annotation" });
for (var i: number = 0; i < data.Profile.length; i++) {
var label: string = null;
if (i === 0) {
label = txLabel;
} else if (i === data.Profile.length - 1) {
label = rxLabel;
}
table.addRow([data.Profile[i].X,
data.Profile[i].Y,
data.Reference[i].Y,
data.Fresnal[i].Y,
data.Fresnal60[i].Y,
label]);
}
/// Set chart options
var options: google.visualization.AreaChartOptions = {
title: "Path profile between TX and RX sites",
is3D: true,
hAxis: {
title: "Distance between Tx Site and Rx site (" + hLabel +
")",
titleTextStyle: { color: "#333" }
},
vAxis: {
title: "Normalized Height Referenced to LOS Path (" +
vLabel + ")",
},
series: {
0: { color: "#6E9A3F" },
1: { color: "#DBAF00", areaOpacity: "0.0" },
2: { color: "#800080", areaOpacity: "0.0" },
3: { color: "#5895DB", areaOpacity: "0.0" }
},
annotation: {
5: { style: "letter" }
},
annotations: {
textStyle: {
bold: true,
italic: true,
color: "black"
}
}
};
/// Create the area chart
var chart: google.visualization.AreaChart = new
google.visualization.AreaChart(document.getElementById(name));
/// Draw the chart
chart.draw(table, options);
}).fail(function (request: any, status: any, error: any): void {
alert(request.responseText);
});
}
On Wednesday, October 8, 2014 8:33:36 PM UTC-4, Andrew Gallant wrote:
> You can't change the placement of the annotation except to place it at a
> different data point. Are you using a discrete (string-based) or
> continuous (number, date, datetime, timeofday based) domain axis?
>
> On Monday, October 6, 2014 11:27:26 AM UTC-4, John Hughes wrote:
>>
>> Andrew,
>>
>> Thanks the annotation allowed me to add the labels to both ends.
>>
>> But the label runs past the end of the chart ends up on top of the number
>> on the left and the legend on the right. Any ideas on how to make them
>> appear fully on the chart. I have tried the textStyle but no luck
>>
>> John
>>
>> On Monday, October 6, 2014 8:56:57 AM UTC-4, Andrew Gallant wrote:
>>
>>> Add an "annotation" role column to your data set (which will be attached
>>> to whatever series of data immediately precedes it in the DataTable). This
>>> is a string type column that contains labels to add to data points. Use
>>> null values for all points that you do not want to have labels. If you
>>> post your chart code and some sample data, I can show you how to add this.
>>>
>>> On Saturday, October 4, 2014 7:46:16 PM UTC-4, John Hughes wrote:
>>>>
>>>> The series suggestion worked perfectly, thanks.
>>>>
>>>> Technically I want to label the first and last points on one of the
>>>> traces. Something along the lines of data[0].label = "start" and
>>>> data[len-1].label = "end". I don't want the labels on the middle points.
>>>>
>>>> Attached is the chart I am trying to emulate. I drew the 1 & 2 where
>>>> the "TX Site 3" & "RX Site 3" labels are. As you can see all four data
>>>> traces start and end at the same point so I can use any trace just need
>>>> the
>>>> two labels.
>>>>
>>>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.