Class: Google::Apis::SheetsV4::ChartSpec
- Inherits:
-
Object
- Object
- Google::Apis::SheetsV4::ChartSpec
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- lib/google/apis/sheets_v4/classes.rb,
lib/google/apis/sheets_v4/representations.rb,
lib/google/apis/sheets_v4/representations.rb
Overview
The specifications of a chart.
Instance Attribute Summary collapse
-
#alt_text ⇒ String
The alternative text that describes the chart.
-
#background_color ⇒ Google::Apis::SheetsV4::Color
Represents a color in the RGBA color space.
-
#background_color_style ⇒ Google::Apis::SheetsV4::ColorStyle
A color value.
-
#basic_chart ⇒ Google::Apis::SheetsV4::BasicChartSpec
The specification for a basic chart.
-
#bubble_chart ⇒ Google::Apis::SheetsV4::BubbleChartSpec
A bubble chart.
-
#candlestick_chart ⇒ Google::Apis::SheetsV4::CandlestickChartSpec
A candlestick chart.
-
#data_source_chart_properties ⇒ Google::Apis::SheetsV4::DataSourceChartProperties
Properties of a data source chart.
-
#filter_specs ⇒ Array<Google::Apis::SheetsV4::FilterSpec>
The filters applied to the source data of the chart.
-
#font_name ⇒ String
The name of the font to use by default for all chart text (e.g. title, axis labels, legend).
-
#hidden_dimension_strategy ⇒ String
Determines how the charts will use hidden rows or columns.
-
#histogram_chart ⇒ Google::Apis::SheetsV4::HistogramChartSpec
A histogram chart.
-
#maximized ⇒ Boolean
(also: #maximized?)
True to make a chart fill the entire space in which it's rendered with minimum padding.
-
#org_chart ⇒ Google::Apis::SheetsV4::OrgChartSpec
An org chart.
-
#pie_chart ⇒ Google::Apis::SheetsV4::PieChartSpec
A pie chart.
-
#scorecard_chart ⇒ Google::Apis::SheetsV4::ScorecardChartSpec
A scorecard chart.
-
#sort_specs ⇒ Array<Google::Apis::SheetsV4::SortSpec>
The order to sort the chart data by.
-
#subtitle ⇒ String
The subtitle of the chart.
-
#subtitle_text_format ⇒ Google::Apis::SheetsV4::TextFormat
The format of a run of text in a cell.
-
#subtitle_text_position ⇒ Google::Apis::SheetsV4::TextPosition
Position settings for text.
-
#title ⇒ String
The title of the chart.
-
#title_text_format ⇒ Google::Apis::SheetsV4::TextFormat
The format of a run of text in a cell.
-
#title_text_position ⇒ Google::Apis::SheetsV4::TextPosition
Position settings for text.
-
#treemap_chart ⇒ Google::Apis::SheetsV4::TreemapChartSpec
A Treemap chart.
-
#waterfall_chart ⇒ Google::Apis::SheetsV4::WaterfallChartSpec
A waterfall chart.
Instance Method Summary collapse
-
#initialize(**args) ⇒ ChartSpec
constructor
A new instance of ChartSpec.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ ChartSpec
Returns a new instance of ChartSpec.
3187 3188 3189 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3187 def initialize(**args) update!(**args) end |
Instance Attribute Details
#alt_text ⇒ String
The alternative text that describes the chart. This is often used for
accessibility.
Corresponds to the JSON property altText
3001 3002 3003 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3001 def alt_text @alt_text end |
#background_color ⇒ Google::Apis::SheetsV4::Color
Represents a color in the RGBA color space. This representation is designed
for simplicity of conversion to and 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. This reference page doesn't have
information about the absolute color space that should be used to interpret
the RGB value—for example, sRGB, Adobe RGB, DCI-P3, and BT.2020. By default,
applications should assume the sRGB color space. When color equality needs to
be decided, implementations, unless documented otherwise, treat two colors as
equal if all their red, green, blue, and alpha values each differ by at most
1e-5. 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
3050 3051 3052 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3050 def background_color @background_color end |
#background_color_style ⇒ Google::Apis::SheetsV4::ColorStyle
A color value.
Corresponds to the JSON property backgroundColorStyle
3055 3056 3057 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3055 def background_color_style @background_color_style end |
#basic_chart ⇒ Google::Apis::SheetsV4::BasicChartSpec
The specification for a basic chart. See BasicChartType for the list of charts
this supports.
Corresponds to the JSON property basicChart
3061 3062 3063 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3061 def basic_chart @basic_chart end |
#bubble_chart ⇒ Google::Apis::SheetsV4::BubbleChartSpec
A bubble chart.
Corresponds to the JSON property bubbleChart
3066 3067 3068 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3066 def bubble_chart @bubble_chart end |
#candlestick_chart ⇒ Google::Apis::SheetsV4::CandlestickChartSpec
A candlestick chart.
Corresponds to the JSON property candlestickChart
3071 3072 3073 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3071 def candlestick_chart @candlestick_chart end |
#data_source_chart_properties ⇒ Google::Apis::SheetsV4::DataSourceChartProperties
Properties of a data source chart.
Corresponds to the JSON property dataSourceChartProperties
3076 3077 3078 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3076 def data_source_chart_properties @data_source_chart_properties end |
#filter_specs ⇒ Array<Google::Apis::SheetsV4::FilterSpec>
The filters applied to the source data of the chart. Only supported for data
source charts.
Corresponds to the JSON property filterSpecs
3082 3083 3084 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3082 def filter_specs @filter_specs end |
#font_name ⇒ String
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
3089 3090 3091 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3089 def font_name @font_name end |
#hidden_dimension_strategy ⇒ String
Determines how the charts will use hidden rows or columns.
Corresponds to the JSON property hiddenDimensionStrategy
3094 3095 3096 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3094 def hidden_dimension_strategy @hidden_dimension_strategy end |
#histogram_chart ⇒ Google::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
3103 3104 3105 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3103 def histogram_chart @histogram_chart end |
#maximized ⇒ Boolean 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
3110 3111 3112 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3110 def maximized @maximized end |
#org_chart ⇒ Google::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
3123 3124 3125 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3123 def org_chart @org_chart end |
#pie_chart ⇒ Google::Apis::SheetsV4::PieChartSpec
A pie chart.
Corresponds to the JSON property pieChart
3128 3129 3130 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3128 def pie_chart @pie_chart end |
#scorecard_chart ⇒ Google::Apis::SheetsV4::ScorecardChartSpec
A scorecard chart. Scorecard charts are used to highlight key performance
indicators, known as KPIs, on the spreadsheet. A scorecard chart can represent
things like total sales, average cost, or a top selling item. You can specify
a single data value, or aggregate over a range of data. Percentage or absolute
difference from a baseline value can be highlighted, like changes over time.
Corresponds to the JSON property scorecardChart
3137 3138 3139 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3137 def scorecard_chart @scorecard_chart end |
#sort_specs ⇒ Array<Google::Apis::SheetsV4::SortSpec>
The order to sort the chart data by. Only a single sort spec is supported.
Only supported for data source charts.
Corresponds to the JSON property sortSpecs
3143 3144 3145 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3143 def sort_specs @sort_specs end |
#subtitle ⇒ String
The subtitle of the chart.
Corresponds to the JSON property subtitle
3148 3149 3150 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3148 def subtitle @subtitle end |
#subtitle_text_format ⇒ Google::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
3154 3155 3156 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3154 def subtitle_text_format @subtitle_text_format end |
#subtitle_text_position ⇒ Google::Apis::SheetsV4::TextPosition
Position settings for text.
Corresponds to the JSON property subtitleTextPosition
3159 3160 3161 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3159 def subtitle_text_position @subtitle_text_position end |
#title ⇒ String
The title of the chart.
Corresponds to the JSON property title
3164 3165 3166 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3164 def title @title end |
#title_text_format ⇒ Google::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
3170 3171 3172 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3170 def title_text_format @title_text_format end |
#title_text_position ⇒ Google::Apis::SheetsV4::TextPosition
Position settings for text.
Corresponds to the JSON property titleTextPosition
3175 3176 3177 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3175 def title_text_position @title_text_position end |
#treemap_chart ⇒ Google::Apis::SheetsV4::TreemapChartSpec
A Treemap chart.
Corresponds to the JSON property treemapChart
3180 3181 3182 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3180 def treemap_chart @treemap_chart end |
#waterfall_chart ⇒ Google::Apis::SheetsV4::WaterfallChartSpec
A waterfall chart.
Corresponds to the JSON property waterfallChart
3185 3186 3187 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3185 def waterfall_chart @waterfall_chart end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 |
# File 'lib/google/apis/sheets_v4/classes.rb', line 3192 def update!(**args) @alt_text = args[:alt_text] if args.key?(:alt_text) @background_color = args[:background_color] if args.key?(:background_color) @background_color_style = args[:background_color_style] if args.key?(:background_color_style) @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) @data_source_chart_properties = args[:data_source_chart_properties] if args.key?(:data_source_chart_properties) @filter_specs = args[:filter_specs] if args.key?(:filter_specs) @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) @scorecard_chart = args[:scorecard_chart] if args.key?(:scorecard_chart) @sort_specs = args[:sort_specs] if args.key?(:sort_specs) @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 |