Class: Google::Apis::SheetsV4::ChartSpec

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
generated/google/apis/sheets_v4/classes.rb,
generated/google/apis/sheets_v4/representations.rb,
generated/google/apis/sheets_v4/representations.rb

Overview

The specifications of a chart.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::JsonObjectSupport

#to_json

Methods included from Core::Hashable

process_value, #to_h

Constructor Details

#initialize(**args) ⇒ ChartSpec

Returns a new instance of ChartSpec



2787
2788
2789
# File 'generated/google/apis/sheets_v4/classes.rb', line 2787

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#alt_textString

The alternative text that describes the chart. This is often used for accessibility. Corresponds to the JSON property altText

Returns:

  • (String)


2574
2575
2576
# File 'generated/google/apis/sheets_v4/classes.rb', line 2574

def alt_text
  @alt_text
end

#background_colorGoogle::Apis::SheetsV4::Color

Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness; for example, the fields of this representation can be trivially provided to the constructor of "java.awt.Color" in Java; it can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" method in iOS; and, with just a little work, it can be easily formatted into a CSS "rgba()" string in JavaScript, as well. Here are some examples: Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); public static Color toProto(java.awt.Color color) float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); return resultBuilder.build(); // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) alpha = [alpha_wrapper value]; return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; static Color* toProto(UIColor* color) CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) return nil; Color* result = [Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) [result setAlpha:floatWrapperWithValue(alpha)]; [result autorelease]; return result; // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) return rgbToCssColor_(red, green, blue); var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); ; var rgbToCssColor_ = function(red, green, blue) var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) resultBuilder.push('0'); resultBuilder.push(hexString); return resultBuilder.join(''); ; // ... Corresponds to the JSON property backgroundColor



2677
2678
2679
# File 'generated/google/apis/sheets_v4/classes.rb', line 2677

def background_color
  @background_color
end

#basic_chartGoogle::Apis::SheetsV4::BasicChartSpec

The specification for a basic chart. See BasicChartType for the list of charts this supports. Corresponds to the JSON property basicChart



2683
2684
2685
# File 'generated/google/apis/sheets_v4/classes.rb', line 2683

def basic_chart
  @basic_chart
end

#bubble_chartGoogle::Apis::SheetsV4::BubbleChartSpec

A bubble chart. Corresponds to the JSON property bubbleChart



2688
2689
2690
# File 'generated/google/apis/sheets_v4/classes.rb', line 2688

def bubble_chart
  @bubble_chart
end

#candlestick_chartGoogle::Apis::SheetsV4::CandlestickChartSpec



2694
2695
2696
# File 'generated/google/apis/sheets_v4/classes.rb', line 2694

def candlestick_chart
  @candlestick_chart
end

#font_nameString

The name of the font to use by default for all chart text (e.g. title, axis labels, legend). If a font is specified for a specific part of the chart it will override this font name. Corresponds to the JSON property fontName

Returns:

  • (String)


2701
2702
2703
# File 'generated/google/apis/sheets_v4/classes.rb', line 2701

def font_name
  @font_name
end

#hidden_dimension_strategyString

Determines how the charts will use hidden rows or columns. Corresponds to the JSON property hiddenDimensionStrategy

Returns:

  • (String)


2706
2707
2708
# File 'generated/google/apis/sheets_v4/classes.rb', line 2706

def hidden_dimension_strategy
  @hidden_dimension_strategy
end

#histogram_chartGoogle::Apis::SheetsV4::HistogramChartSpec

A histogram chart. A histogram chart groups data items into bins, displaying each bin as a column of stacked items. Histograms are used to display the distribution of a dataset. Each column of items represents a range into which those items fall. The number of bins can be chosen automatically or specified explicitly. Corresponds to the JSON property histogramChart



2716
2717
2718
# File 'generated/google/apis/sheets_v4/classes.rb', line 2716

def histogram_chart
  @histogram_chart
end

#maximizedBoolean Also known as: maximized?

True to make a chart fill the entire space in which it's rendered with minimum padding. False to use the default padding. (Not applicable to Geo and Org charts.) Corresponds to the JSON property maximized

Returns:

  • (Boolean)


2723
2724
2725
# File 'generated/google/apis/sheets_v4/classes.rb', line 2723

def maximized
  @maximized
end

#org_chartGoogle::Apis::SheetsV4::OrgChartSpec

An org chart. Org charts require a unique set of labels in labels and may optionally include parent_labels and tooltips. parent_labels contain, for each node, the label identifying the parent node. tooltips contain, for each node, an optional tooltip. For example, to describe an OrgChart with Alice as the CEO, Bob as the President (reporting to Alice) and Cathy as VP of Sales (also reporting to Alice), have labels contain "Alice", "Bob", "Cathy", parent_labels contain "", "Alice", "Alice" and tooltips contain "CEO", "President", "VP Sales". Corresponds to the JSON property orgChart



2738
2739
2740
# File 'generated/google/apis/sheets_v4/classes.rb', line 2738

def org_chart
  @org_chart
end

#pie_chartGoogle::Apis::SheetsV4::PieChartSpec

A pie chart. Corresponds to the JSON property pieChart



2743
2744
2745
# File 'generated/google/apis/sheets_v4/classes.rb', line 2743

def pie_chart
  @pie_chart
end

#subtitleString

The subtitle of the chart. Corresponds to the JSON property subtitle

Returns:

  • (String)


2748
2749
2750
# File 'generated/google/apis/sheets_v4/classes.rb', line 2748

def subtitle
  @subtitle
end

#subtitle_text_formatGoogle::Apis::SheetsV4::TextFormat

The format of a run of text in a cell. Absent values indicate that the field isn't specified. Corresponds to the JSON property subtitleTextFormat



2754
2755
2756
# File 'generated/google/apis/sheets_v4/classes.rb', line 2754

def subtitle_text_format
  @subtitle_text_format
end

#subtitle_text_positionGoogle::Apis::SheetsV4::TextPosition

Position settings for text. Corresponds to the JSON property subtitleTextPosition



2759
2760
2761
# File 'generated/google/apis/sheets_v4/classes.rb', line 2759

def subtitle_text_position
  @subtitle_text_position
end

#titleString

The title of the chart. Corresponds to the JSON property title

Returns:

  • (String)


2764
2765
2766
# File 'generated/google/apis/sheets_v4/classes.rb', line 2764

def title
  @title
end

#title_text_formatGoogle::Apis::SheetsV4::TextFormat

The format of a run of text in a cell. Absent values indicate that the field isn't specified. Corresponds to the JSON property titleTextFormat



2770
2771
2772
# File 'generated/google/apis/sheets_v4/classes.rb', line 2770

def title_text_format
  @title_text_format
end

#title_text_positionGoogle::Apis::SheetsV4::TextPosition

Position settings for text. Corresponds to the JSON property titleTextPosition



2775
2776
2777
# File 'generated/google/apis/sheets_v4/classes.rb', line 2775

def title_text_position
  @title_text_position
end

#treemap_chartGoogle::Apis::SheetsV4::TreemapChartSpec

A Treemap chart. Corresponds to the JSON property treemapChart



2780
2781
2782
# File 'generated/google/apis/sheets_v4/classes.rb', line 2780

def treemap_chart
  @treemap_chart
end

#waterfall_chartGoogle::Apis::SheetsV4::WaterfallChartSpec

A waterfall chart. Corresponds to the JSON property waterfallChart



2785
2786
2787
# File 'generated/google/apis/sheets_v4/classes.rb', line 2785

def waterfall_chart
  @waterfall_chart
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
# File 'generated/google/apis/sheets_v4/classes.rb', line 2792

def update!(**args)
  @alt_text = args[:alt_text] if args.key?(:alt_text)
  @background_color = args[:background_color] if args.key?(:background_color)
  @basic_chart = args[:basic_chart] if args.key?(:basic_chart)
  @bubble_chart = args[:bubble_chart] if args.key?(:bubble_chart)
  @candlestick_chart = args[:candlestick_chart] if args.key?(:candlestick_chart)
  @font_name = args[:font_name] if args.key?(:font_name)
  @hidden_dimension_strategy = args[:hidden_dimension_strategy] if args.key?(:hidden_dimension_strategy)
  @histogram_chart = args[:histogram_chart] if args.key?(:histogram_chart)
  @maximized = args[:maximized] if args.key?(:maximized)
  @org_chart = args[:org_chart] if args.key?(:org_chart)
  @pie_chart = args[:pie_chart] if args.key?(:pie_chart)
  @subtitle = args[:subtitle] if args.key?(:subtitle)
  @subtitle_text_format = args[:subtitle_text_format] if args.key?(:subtitle_text_format)
  @subtitle_text_position = args[:subtitle_text_position] if args.key?(:subtitle_text_position)
  @title = args[:title] if args.key?(:title)
  @title_text_format = args[:title_text_format] if args.key?(:title_text_format)
  @title_text_position = args[:title_text_position] if args.key?(:title_text_position)
  @treemap_chart = args[:treemap_chart] if args.key?(:treemap_chart)
  @waterfall_chart = args[:waterfall_chart] if args.key?(:waterfall_chart)
end