Skip to content

Instantly share code, notes, and snippets.

View ima87's full-sized avatar

Imalka Hemachandra ima87

View GitHub Profile
MetadataService.MetadataPort service = createService();
//save new custom label
MetadataService.CustomLabel cl = new MetadataService.CustomLabel();
cl.fullName = 'CustomLabel1';
cl.language = 'en_US';
cl.protected_x = true;
cl.shortDescription = 'Custom label short description';
cl.value = 'Custom label value';
var mainChart = new google.visualization.PieChart(document.getElementById('mainChart'));
mainChart.draw(dataTable, option);
google.visualization.events.addListener(mainChart, 'select', function() {
var selection = mainChart.getSelection();
var message = '';
for (var i = 0; i < selection.length; i++) {
var item = selection[i];
@ima87
ima87 / tooltips
Last active August 29, 2015 14:18
Use html tags inside tooltips
var data = new google.visualization.DataTable();
data.addColumn('string', 'Range');
data.addColumn('number', NPS);
data.addColumn({'type': 'string', 'role': 'tooltip', 'p': {'html': true}});
// allow html on tooltip
for(var i = 0; i < result.length; i++) {
var p = result[i];
// change tooltip content by adding text with html
data.addRow([p.chartLabel , p.nps , '<b> NPS : </b>' + p.nps ]);
@ima87
ima87 / using-vaxes
Last active August 29, 2015 14:18
Show multiple axes in a single chart
vAxes: {
0: {logScale: false, maxValue: 100, minValue: 0, textStyle : { color: '#ffffff'}},
1: {logScale: false, maxValue: 100, minValue:-100, textStyle : { color:'#ffffff'}}
}
@ima87
ima87 / using-combo-charts
Last active August 29, 2015 14:18
The way to combine multiple chart types
var options = {
title : 'With labels on vertical axes',
vAxes: {
0: {logScale: false, maxValue: 100, minValue: 0},
1: {logScale: false, maxValue: 100, minValue: -100}
},
seriesType: "bars",
isStacked: true,
series: {
0: { targetAxisIndex:0 },