Ajax (1) Apex Class (12) Apex Trigger (2) Community (2) Home Page (1) HTML (4) Integration (3) JS (7) KB (1) Label (1) Licenses (1) Listing (1) Log (1) OOPs (5) Sharing (1) Static Resource (1) Test Class (3) URI (1) Visualforce (10)

Tuesday 28 October 2014

All valid HTTP 1.1 Status Codes simply explained.

All valid HTTP 1.1 Status Codes simply explained.

HTTP, Hypertext Transfer Protocol, is the method by which clients (i.e. you) and servers communicate. When someone clicks a link, types in a URL or submits out a form, their browser sends a request to a server for information. It might be asking for a page, or sending data, but either way, that is called an HTTP Request. When a server receives that request, it sends back an HTTP Response, with information for the client. Usually, this is invisible, though I'm sure you've seen one of the very common Response codes - 404, indicating a page was not found. There are a fair few more status codes sent by servers, and the following is a list of the current ones in HTTP 1.1, along with an explanation of their meanings.

A more technical breakdown of HTTP 1.1 status codes and their meanings is available athttp://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html. There are several versions of HTTP, but currently HTTP 1.1 is the most widely used.

Informational

  • 100 - Continue
    A status code of 100 indicates that (usually the first) part of a request has been received without any problems, and that the rest of the request should now be sent.
  • 101 - Switching Protocols
    HTTP 1.1 is just one type of protocol for transferring data on the web, and a status code of 101 indicates that the server is changing to the protocol it defines in the "Upgrade" header it returns to the client. For example, when requesting a page, a browser might receive a statis code of 101, followed by an "Upgrade" header showing that the server is changing to a different version of HTTP.

Successful

  • 200 - OK
    The 200 status code is by far the most common returned. It means, simply, that the request was received and understood and is being processed.
  • 201 - Created
    A 201 status code indicates that a request was successful and as a result, a resource has been created (for example a new page).
  • 202 - Accepted
    The status code 202 indicates that server has received and understood the request, and that it has been accepted for processing, although it may not be processed immediately.
  • 203 - Non-Authoritative Information
    A 203 status code means that the request was received and understood, and that information sent back about the response is from a third party, rather than the original server. This is virtually identical in meaning to a 200 status code.
  • 204 - No Content
    The 204 status code means that the request was received and understood, but that there is no need to send any data back.
  • 205 - Reset Content
    The 205 status code is a request from the server to the client to reset the document from which the original request was sent. For example, if a user fills out a form, and submits it, a status code of 205 means the server is asking the browser to clear the form.
  • 206 - Partial Content
    A status code of 206 is a response to a request for part of a document. This is used by advanced caching tools, when a user agent requests only a small part of a page, and just that section is returned.

Redirection

  • 300 - Multiple Choices
    The 300 status code indicates that a resource has moved. The response will also include a list of locations from which the user agent can select the most appropriate.
  • 301 - Moved Permanently
    A status code of 301 tells a client that the resource they asked for has permanently moved to a new location. The response should also include this location. It tells the client to use the new URL the next time it wants to fetch the same resource.
  • 302 - Found
    A status code of 302 tells a client that the resource they asked for has temporarily moved to a new location. The response should also include this location. It tells the client that it should carry on using the same URL to access this resource.
  • 303 - See Other
    A 303 status code indicates that the response to the request can be found at the specified URL, and should be retrieved from there. It does not mean that something has moved - it is simply specifying the address at which the response to the request can be found.
  • 304 - Not Modified
    The 304 status code is sent in response to a request (for a document) that asked for the document only if it was newer than the one the client already had. Normally, when a document is cached, the date it was cached is stored. The next time the document is viewed, the client asks the server if the document has changed. If not, the client just reloads the document from the cache.
  • 305 - Use Proxy
    A 305 status code tells the client that the requested resource has to be reached through a proxy, which will be specified in the response.
  • 307 - Temporary Redirect
    307 is the status code that is sent when a document is temporarily available at a different URL, which is also returned. There is very little difference between a 302 status code and a 307 status code. 307 was created as another, less ambiguous, version of the 302 status code.

Client Error

  • 400 - Bad Request
    A status code of 400 indicates that the server did not understand the request due to bad syntax.
  • 401 - Unauthorized
    A 401 status code indicates that before a resource can be accessed, the client must be authorised by the server.
  • 402 - Payment Required
    The 402 status code is not currently in use, being listed as "reserved for future use".
  • 403 - Forbidden
    A 403 status code indicates that the client cannot access the requested resource. That might mean that the wrong username and password were sent in the request, or that the permissions on the server do not allow what was being asked.
  • 404 - Not Found
    The best known of them all, the 404 status code indicates that the requested resource was not found at the URL given, and the server has no idea how long for.
  • 405 - Method Not Allowed
    A 405 status code is returned when the client has tried to use a request method that the server does not allow. Request methods that are allowed should be sent with the response (common request methods are POST and GET).
  • 406 - Not Acceptable
    The 406 status code means that, although the server understood and processed the request, the response is of a form the client cannot understand. A client sends, as part of a request, headers indicating what types of data it can use, and a 406 error is returned when the response is of a type not i that list.
  • 407 - Proxy Authentication Required
    The 407 status code is very similar to the 401 status code, and means that the client must be authorised by the proxy before the request can proceed.
  • 408 - Request Timeout
    A 408 status code means that the client did not produce a request quickly enough. A server is set to only wait a certain amount of time for responses from clients, and a 408 status code indicates that time has passed.
  • 409 - Conflict
    A 409 status code indicates that the server was unable to complete the request, often because a file would need to be editted, created or deleted, and that file cannot be editted, created or deleted.
  • 410 - Gone
    A 410 status code is the 404's lesser known cousin. It indicates that a resource has permanently gone (a 404 status code gives no indication if a resource has gine permanently or temporarily), and no new address is known for it.
  • 411 - Length Required
    The 411 status code occurs when a server refuses to process a request because a content length was not specified.
  • 412 - Precondition Failed
    A 412 status code indicates that one of the conditions the request was made under has failed.
  • 413 - Request Entity Too Large
    The 413 status code indicates that the request was larger than the server is able to handle, either due to physical constraints or to settings. Usually, this occurs when a file is sent using the POST method from a form, and the file is larger than the maximum size allowed in the server settings.
  • 414 - Request-URI Too Long
    The 414 status code indicates the the URL requested by the client was longer than it can process.
  • 415 - Unsupported Media Type
    A 415 status code is returned by a server to indicate that part of the request was in an unsupported format.
  • 416 - Requested Range Not Satisfiable
    A 416 status code indicates that the server was unable to fulfill the request. This may be, for example, because the client asked for the 800th-900th bytes of a document, but the document was only 200 bytes long.
  • 417 - Expectation Failed
    The 417 status code means that the server was unable to properly complete the request. One of the headers sent to the server, the "Expect" header, indicated an expectation the server could not meet.

Server Error

  • 500 - Internal Server Error
    A 500 status code (all too often seen by Perl programmers) indicates that the server encountered something it didn't expect and was unable to complete the request.
  • 501 - Not Implemented
    The 501 status code indicates that the server does not support all that is needed for the request to be completed.
  • 502 - Bad Gateway
    A 502 status code indicates that a server, while acting as a proxy, received a response from a server further upstream that it judged invalid.
  • 503 - Service Unavailable
    A 503 status code is most often seen on extremely busy servers, and it indicates that the server was unable to complete the request due to a server overload.
  • 504 - Gateway Timeout
    A 504 status code is returned when a server acting as a proxy has waited too long for a response from a server further upstream.
  • 505 - HTTP Version Not Supported
    A 505 status code is returned when the HTTP version indicated in the request is no supported. The response should indicate which HTTP versions are supported.

Monday 20 October 2014

Schedulable

global class scheduledMonthly implements Schedulable {
   
    global void execute(SchedulableContext sc) {
List<User> lstUser=new List<User>();
     for(User obj:[SELECT id,name,lastlogindate,isActive FROM User where lastlogindate<=LAST_N_DAYS:30])
{
 User objNew=obj.id;
 objNew.isActive=false;
 lstUser.add(objNew)
}
if(lstUser!=null && lstUser.size()>0)
{
update lstUser;
}
 
    }
}

Friday 17 October 2014

How to get Total unused User Licenses

String result;
String orgName;
String orgCountry;
         Organization orgDetails =[ select Id, Name, Country from Organization limit 1];
            Id orgId = orgDetails.Id;
            orgName = orgDetails.Name;
            orgCountry = orgDetails.Country;

        PageReference pr=new PageReference('/'+orgId);
        //called screenscraping: get the data from the page
        String rawData=pr.getContent().toString();
   String licRow = '>Salesforce</th><td class=" dataCell  ">Active</td><td class=" dataCell  numericalColumn">';
    Integer licLen = licRow.length();
  Integer pos=rawData.indexOf(licRow);
if (-1!=pos)
{
         Integer licStart = pos + licLen;
         result=rawData.substring(licStart, licStart+3);
}
Decimal lic = decimal.valueOf(result);
integer u = [select count() from user where profile.UserLicense.Name = 'salesforce' and isactive = true];
Decimal userCount = decimal.valueOf(u);
Integer totalUnused = (lic.intValue() - userCount.intValue());
System.debug('************ Licenses???? ***************** ' + String.valueOf(totalUnused));

Monday 13 October 2014

Pie Chart google

Visualization: Pie Chart

  1. Overview
  2. A Simple Example
  3. Making a 3D Pie Chart
  4. Making a Donut Chart
  5. Rotating a Pie Chart
  6. Exploding a Slice
  7. Removing Slices
  8. Loading
  9. Data Format
  10. Configuration Options
  11. Methods
  12. Events
  13. Data Policy

Overview

A pie chart that is rendered within the browser using SVG or VML. Displays tooltips when hovering over slices.

Example

<html>
 
<head>
   
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
   
<script type="text/javascript">
      google
.load("visualization", "1", {packages:["corechart"]});
      google
.setOnLoadCallback(drawChart);
     
function drawChart() {

       
var data = google.visualization.arrayToDataTable([
         
['Task', 'Hours per Day'],
         
['Work',     11],
         
['Eat',      2],
         
['Commute',  2],
         
['Watch TV', 2],
         
['Sleep',    7]
       
]);

       
var options = {
          title
: 'My Daily Activities'
       
};

       
var chart = new google.visualization.PieChart(document.getElementById('piechart'));

        chart
.draw(data, options);
     
}
   
</script>
 
</head>
 
<body>
   
<div id="piechart" style="width: 900px; height: 500px;"></div>
 
</body>
</html>

Making a 3D Pie Chart

If you set the is3D option to true, your pie chart will be drawn as though it has three dimensions:

is3D is false by default, so here we explicitly set it to true:

<html>
 
<head>
   
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
   
<script type="text/javascript">
      google
.load("visualization", "1", {packages:["corechart"]});
      google
.setOnLoadCallback(drawChart);
     
function drawChart() {
       
var data = google.visualization.arrayToDataTable([
         
['Task', 'Hours per Day'],
         
['Work',     11],
         
['Eat',      2],
         
['Commute',  2],
         
['Watch TV', 2],
         
['Sleep',    7]
       
]);

       
var options = {
          title
: 'My Daily Activities',
         
is3D: true,
       
};

       
var chart = new google.visualization.PieChart(document.getElementById('piechart_3d'));
        chart
.draw(data, options);
     
}
   
</script>
 
</head>
 
<body>
   
<div id="piechart_3d" style="width: 900px; height: 500px;"></div>
 
</body>
</html>

Making a Donut Chart

donut chart is a pie chart with a hole in the center. You can create donut charts with the pieHole option:

The pieHole option should be set to a number between 0 and 1, corresponding to the ratio of radii between the hole and the chart. Numbers between 0.4 and 0.6 will look best on most charts. Values equal to or greater than 1 will be ignored, and a value of 0 will completely shut your piehole.

<html>
 
<head>
   
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
   
<script type="text/javascript">
      google
.load("visualization", "1", {packages:["corechart"]});
      google
.setOnLoadCallback(drawChart);
     
function drawChart() {
       
var data = google.visualization.arrayToDataTable([
         
['Task', 'Hours per Day'],
         
['Work',     11],
         
['Eat',      2],
         
['Commute',  2],
         
['Watch TV', 2],
         
['Sleep',    7]
       
]);

       
var options = {
          title
: 'My Daily Activities',
         
pieHole: 0.4,
       
};

       
var chart = new google.visualization.PieChart(document.getElementById('donutchart'));
        chart
.draw(data, options);
     
}
   
</script>
 
</head>
 
<body>
   
<div id="donutchart" style="width: 900px; height: 500px;"></div>
 
</body>
</html>

You can't combine the pieHole and is3D options; if you do, pieHole will be ignored.

Rotating a Pie Chart

By default, pie charts begin with the left edge of the first slice pointing straight up. You can change that with the pieStartAngle option:

Here, we rotate the chart clockwise 100 degrees with an option of pieStartAngle: 100. (So chosen because that particular angle happens to make the "Italian" label fit inside the slice.)

<html>
 
<head>
   
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
   
<script type="text/javascript">
      google
.load("visualization", "1", {packages:["corechart"]});
      google
.setOnLoadCallback(drawChart);
     
function drawChart() {
       
var data = google.visualization.arrayToDataTable([
         
['Language', 'Speakers (in millions)'],
         
['German',  5.85],
         
['French',  1.66],
         
['Italian', 0.316],
         
['Romansh', 0.0791]
       
]);

     
var options = {
        legend
: 'none',
        pieSliceText
: 'label',
        title
: 'Swiss Language Use (100 degree rotation)',
       
pieStartAngle: 100,
     
};

       
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
        chart
.draw(data, options);
     
}
   
</script>
 
</head>
 
<body>
   
<div id="piechart" style="width: 900px; height: 500px;"></div>
 
</body>
</html>

Exploding a Slice

You can separate pie slices from the rest of the chart with the offset property of the slices option: To separate a slice, create a slices object and assign the appropriate slice number an offset between 0 and 1. Below, we assign progressively larger offsets to slices 4 (Gujarati), 12 (Marathi), 14 (Oriya), and 15 (Punjabi):

<html>
 
<head>
   
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
   
<script type="text/javascript">
      google
.load("visualization", "1", {packages:["corechart"]});
      google
.setOnLoadCallback(drawChart);
     
function drawChart() {
       
var data = google.visualization.arrayToDataTable([
         
['Language', 'Speakers (in millions)'],
         
['Assamese', 13], ['Bengali', 83], ['Bodo', 1.4],
         
['Dogri', 2.3], ['Gujarati', 46], ['Hindi', 300],
         
['Kannada', 38], ['Kashmiri', 5.5], ['Konkani', 5],
         
['Maithili', 20], ['Malayalam', 33], ['Manipuri', 1.5],
         
['Marathi', 72], ['Nepali', 2.9], ['Oriya', 33],
         
['Punjabi', 29], ['Sanskrit', 0.01], ['Santhali', 6.5],
         
['Sindhi', 2.5], ['Tamil', 61], ['Telugu', 74], ['Urdu', 52]
       
]);

       
var options = {
          title
: 'Indian Language Use',
          legend
: 'none',
          pieSliceText
: 'label',
         
slices: {  4: {offset: 0.2},
                   
12: {offset: 0.3},
                   
14: {offset: 0.4},
                   
15: {offset: 0.5},
         
},

       
};

       
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
        chart
.draw(data, options);
     
}
   
</script>
 
</head>
 
<body>
   
<div id="piechart" style="width: 900px; height: 500px;"></div>
 
</body>
</html>

Removing Slices

To omit a slice, change the color to 'transparent':

We also used the pieStartAngle to rotate the chart 135 degrees, pieSliceText to remove the text from the slices, and tooltip.trigger to disable tooltips:

<html>    <head>      <script type="text/javascript" src="https://www.google.com/jsapi"></script>      <script type="text/javascript">        google.load("visualization", "1", {packages:["corechart"]});        google.setOnLoadCallback(drawChart);        function drawChart() {          var data = google.visualization.arrayToDataTable([            ['Pac Man', 'Percentage'],            ['', 75],            ['', 25]          ]);            var options = {            legend: 'none',            pieSliceText: 'none',            pieStartAngle: 135,            tooltip: { trigger: 'none' },            slices: {              0: { color: 'yellow' },              1: { color: 'transparent' }            }          };            var chart = new google.visualization.PieChart(document.getElementById('pacman'));          chart.draw(data, options);        }      </script>    </head>    <body>      <div id="pacman" style="width: 900px; height: 500px;"></div>    </body>  </html>  

Loading

The google.load package name is "corechart".

  google.load("visualization", "1", {packages: ["corechart"]});

The visualization's class name is google.visualization.PieChart.

  var visualization = new google.visualization.PieChart(container);

Data Format

Rows: Each row in the table represents a slice.

Columns:

 Column 0Column 1
Purpose:Slice labelsSlice values
Data Type:stringnumber
Role:domaindata
Optional column roles:NoneNone

Configuration Options

NameTypeDefaultDescription
backgroundColorstring or object'white'The background color for the main area of the chart. Can be either a simple HTML color string, for example: 'red' or '#00cc00', or an object with the following properties.
backgroundColor.strokestring'#666'The color of the chart border, as an HTML color string.
backgroundColor.strokeWidthnumber0The border width, in pixels.
backgroundColor.fillstring'white'The chart fill color, as an HTML color string.
chartAreaObjectnullAn object with members to configure the placement and size of the chart area (where the chart itself is drawn, excluding axis and legends). Two formats are supported: a number, or a number followed by %. A simple number is a value in pixels; a number followed by % is a percentage. Example: chartArea:{left:20,top:0,width:'50%',height:'75%'}
chartArea.backgroundColorstring or object'white'Chart area background color. When a string is used, it can be either a hex string (e.g., '#fdc') or an English color name. When an object is used, the following properties can be provided:
  • stroke: the color, provided as a hex string or English color name.
  • strokeWidth: if provided, draws a border around the chart area of the given width (and with the color of stroke).
chartArea.leftnumber or stringautoHow far to draw the chart from the left border.
chartArea.topnumber or stringautoHow far to draw the chart from the top border.
chartArea.widthnumber or stringautoChart area width.
chartArea.heightnumber or stringautoChart area height.
colorsArray of stringsdefault colorsThe colors to use for the chart elements. An array of strings, where each element is an HTML color string, for example: colors:['red','#004411'].
enableInteractivitybooleantrueWhether the chart throws user-based events or reacts to user interaction. If false, the chart will not throw 'select' or other interaction-based events (but willthrow ready or error events), and will not display hovertext or otherwise change depending on user input.
fontSizenumberautomaticThe default font size, in pixels, of all text in the chart. You can override this using properties for specific chart elements.
fontNamestring'Arial'The default font face for all text in the chart. You can override this using properties for specific chart elements.
forceIFramebooleanfalseDraws the chart inside an inline frame. (Note that on IE8, this option is ignored; all IE8 charts are drawn in i-frames.)
heightnumberheight of the containing elementHeight of the chart, in pixels.
is3DbooleanfalseIf true, displays a three-dimensional chart.
legendObjectnull

An object with members to configure various aspects of the legend. To specify properties of this object, you can use object literal notation, as shown here:

{position: 'top', textStyle: {color: 'blue', fontSize: 16}}
legend.alignmentstringautomaticAlignment of the legend. Can be one of the following:
  • 'start' - Aligned to the start of the area allocated for the legend.
  • 'center' - Centered in the area allocated for the legend.
  • 'end' - Aligned to the end of the area allocated for the legend.

Start, center, and end are relative to the style -- vertical or horizontal -- of the legend. For example, in a 'right' legend, 'start' and 'end' are at the top and bottom, respectively; for a 'top' legend, 'start' and 'end' would be at the left and right of the area, respectively.

The default value depends on the legend's position. For 'bottom' legends, the default is 'center'; other legends default to 'start'.

legend.positionstring'right'Position of the legend. Can be one of the following:
  • 'bottom' - Displays the legend below the chart.
  • 'labeled' - Draws lines connecting slices to their data values.
  • 'left' - Displays the legend left of the chart.
  • 'none' - Displays no legend.
  • 'right' - Displays the legend right of the chart.
  • 'top' - Displays the legend above the chart.
legend.maxLinesnumber1

Maximum number of lines in the legend. Set this to a number greater than one to add lines to your legend. Note: The exact logic used to determine the actual number of lines rendered is still in flux.

This option currently works only when legend.position is 'top'.

legend.textStyleObject{color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>}

An object that specifies the legend text style. The object has this format:

{ color: <string>,    fontName: <string>,    fontSize: <number>,    bold: <boolean>,    italic: <boolean> }  

The color can be any HTML color string, for example: 'red' or '#00cc00'. Also see fontName and fontSize.

pieHolenumber0If between 0 and 1, displays a donut chart. The hole with have a radius equal tonumber times the radius of the chart.
pieSliceBorderColorstring'white'The color of the slice borders. Only applicable when the chart is two-dimensional.
pieSliceTextstring'percentage'The content of the text displayed on the slice. Can be one of the following:
  • 'percentage' - The percentage of the slice size out of the total.
  • 'value' - The quantitative value of the slice.
  • 'label' - The name of the slice.
  • 'none' - No text is displayed.
pieSliceTextStyleObject{color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>}

An object that specifies the slice text style. The object has this format:

 {color: <string>, fontName: <string>, fontSize: <number>}

The color can be any HTML color string, for example: 'red' or '#00cc00'. Also see fontName and fontSize.

pieStartAngleNumber0

The angle, in degrees, to rotate the chart by. The default of 0 will orient the leftmost edge of the first slice directly up.

reverseCategoriesbooleanfalseIf true, draws slices counterclockwise. The default is to draw clockwise.
pieResidueSliceColorstring'#ccc'Color for the combination slice that holds all slices belowsliceVisibilityThreshold.
pieResidueSliceLabelstring'Other'A label for the combination slice that holds all slices belowsliceVisibilityThreshold.
slicesArray of objects, or object with nested objects{}

An array of objects, each describing the format of the corresponding slice in the pie. To use default values for a slice, specify an empty object (i.e., {}). If a slice or a value is not specified, the global value will be used. Each object supports the following properties:

  • color - The color to use for this slice. Specify a valid HTML color string.
  • offset - How far to separate the slice from the rest of the pie, from 0.0 (not at all) to 1.0 (the pie's radius).
  • textStyle - Overrides the global pieSliceTextSlice for this slice.

You can specify either an array of objects, each of which applies to the slice in the order given, or you can specify an object where each child has a numeric key indicating which slice it applies to. For example, the following two declarations are identical, and declare the first slice as black and the fourth as red:

slices: [{color: 'black', {}, {}, {color: 'red'}]  slices: {0: {color: 'black'}, 3: {color: 'red'}}
sliceVisibilityThresholdnumber1/720The slice relative part, below which a slice will not show individually. All slices that have not passed this threshold will be combined to a single slice, whose size is the sum of all their sizes. Default is not to show individually any slice which is smaller than half a degree.
titlestringno titleText to display above the chart.
titleTextStyleObject{color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>}

An object that specifies the title text style. The object has this format:

{ color: <string>,    fontName: <string>,    fontSize: <number>,    bold: <boolean>,    italic: <boolean> }  

The color can be any HTML color string, for example: 'red' or '#00cc00'. Also see fontName and fontSize.

tooltipObjectnull

An object with members to configure various tooltip elements. To specify properties of this object, you can use object literal notation, as shown here:

 {textStyle: {color: '#FF0000'}, showColorCode: true}
tooltip.showColorCodebooleanfalseIf true, show colored squares next to the slice information in the tooltip.
tooltip.textstring'both'

What information to display when the user hovers over a pie slice. The following values are supported:

  • 'both' - [Default] Display both the absolute value of the slice and the percentage of the whole.
  • 'value' - Display only the absolute value of the slice.
  • 'percentage' - Display only the percentage of the whole represented by the slice.
tooltip.textStyleObject{color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>}

An object that specifies the tooltip text style. The object has this format:

{ color: <string>,    fontName: <string>,    fontSize: <number>,    bold: <boolean>,    italic: <boolean> }  

The color can be any HTML color string, for example: 'red' or '#00cc00'. Also see fontName and fontSize.

tooltip.triggerstring'focus'

The user interaction that causes the tooltip to be displayed:

  • 'focus' - The tooltip will be displayed when the user hovers over the element.
  • 'none' - The tooltip will not be displayed.
  • 'selection' - The tooltip will be displayed when the user selects the element.
widthnumberwidth of the containing elementWidth of the chart, in pixels.

Methods

MethodReturn TypeDescription
draw(data, options)noneDraws the chart. The chart accepts further method calls only after the ready event is fired.Extended description.
getBoundingBox(id)Object

Returns an object containing the left, top, width, and height of chart element id. The format forid isn't yet documented (they're the return values of event handlers), but here are some examples:

 var cli = chart.getChartLayoutInterface();

Height of the chart area
cli.getBoundingBox('chartarea').height
Width of the third bar in the first series of a bar or column chart
cli.getBoundingBox('bar#0#2').width
Bounding box of the fifth wedge of a pie chart
cli.getBoundingBox('slice#4')
Bounding box of the chart data of a vertical (e.g., column) chart:
cli.getBoundingBox('vAxis#0#gridline')
Bounding box of the chart data of a horizontal (e.g., bar) chart:
cli.getBoundingBox('hAxis#0#gridline')

Values are relative to the container of the chart. Call this after the chart is drawn.

getChartAreaBoundingBox()Object

Returns an object containing the left, top, width, and height of the chart content (i.e., excluding labels and legend):

 var cli = chart.getChartLayoutInterface();

cli.getChartAreaBoundingBox().left
cli.getChartAreaBoundingBox().top
cli.getChartAreaBoundingBox().height
cli.getChartAreaBoundingBox().width

Values are relative to the container of the chart. Call this after the chart is drawn.

getChartLayoutInterface()Object

Returns an object containing information about the onscreen placement of the chart and its elements.

The following methods can be called on the returned object:

  • getBoundingBox
  • getChartAreaBoundingBox
  • getHAxisValue
  • getVAxisValue
  • getXLocation
  • getYLocation

Call this after the chart is drawn.

getHAxisValue(position, optional_axis_index)Number

Returns the logical horizontal value at position, which is an offset from the chart container's left edge. Can be negative.

Example: chart.getChartLayoutInterface().getHAxisValue(400).

Call this after the chart is drawn.

getImageURI()String

Returns the chart serialized as an image URI.

Call this after the chart is drawn.

See Printing PNG Charts.

getSelection()Array of selection elementsReturns an array of the selected chart entities. Selectable entities are slices and legend entries. A slice or legend entry correlates to a row in the data table (column index is null). For this chart, only one entity can be selected at any given moment. Extended description.
getVAxisValue(position, optional_axis_index)Number

Returns the logical vertical value at position, which is an offset from the chart container's top edge. Can be negative.

Example: chart.getChartLayoutInterface().getVAxisValue(300).

Call this after the chart is drawn.

getXLocation(position, optional_axis_index)Number

Returns the screen x-coordinate of position relative to the chart's container.

Example: chart.getChartLayoutInterface().getXLocation(400).

Call this after the chart is drawn.

getYLocation(position, optional_axis_index)Number

Returns the screen y-coordinate of position relative to the chart's container.

Example: chart.getChartLayoutInterface().getYLocation(300).

Call this after the chart is drawn.

setSelection()noneSelects the specified chart entities. Cancels any previous selection. Selectable entities are slices and legend entries. A slice or legend entry correlates to a row in the data table (column index is null). For this chart, only one entity can be selected at a time. Extended description.
clearChart()noneClears the chart, and releases all of its allocated resources.

Events

For more information on how to use these events, see Basic InteractivityHandling Events, and Firing Events.

NameDescriptionProperties
clickFired when the user clicks inside the chart. Can be used to identify when the title, data elements, legend entries, axes, gridlines, or labels are clicked.targetID
errorFired when an error occurs when attempting to render the chart.id, message
onmouseoverFired when the user mouses over a visual entity. Passes back the row and column indices of the corresponding data table element. A slice or legend entry correlates to a row in the data table (column index is null).row, column
onmouseoutFired when the user mouses away from a visual entity. Passes back the row and column indices of the corresponding data table element. A slice or legend entry correlates to a row in the data table (column index is null).row, column
readyThe chart is ready for external method calls. If you want to interact with the chart, and call methods after you draw it, you should set up a listener for this event before you call the draw method, and call them only after the event was fired.None
selectFired when the user clicks a visual entity. To learn what has been selected, call getSelection().None

Data Policy

All code and data are processed and rendered in the browser. No data is sent to any server.