40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/asposeslidesjava/Charts/errorbars.rb', line 40
def add_custom_error_bar_value()
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
pres = Rjb::import('com.aspose.slides.Presentation').new
slide = pres.getSlides().get_Item(0)
chart = pres.getSlides().get_Item(0).getShapes().addChart(Rjb::import('com.aspose.slides.ChartType').Bubble, 50, 50, 400, 300, true)
error_bar_value_type = Rjb::import('com.aspose.slides.ErrorBarValueType')
series = chart.getChartData().getSeries().get_Item(0)
error_bar_x = series.getErrorBarsXFormat()
error_bar_y = series.getErrorBarsYFormat()
error_bar_x.setValueType(error_bar_value_type.Custom)
error_bar_y.setValueType(error_bar_value_type.Custom)
data_source_type = Rjb::import('com.aspose.slides.DataSourceType')
points = series.getDataPoints()
points.getDataSourceTypeForErrorBarsCustomValues().setDataSourceTypeForXPlusValues(data_source_type.DoubleLiterals)
points.getDataSourceTypeForErrorBarsCustomValues().setDataSourceTypeForXMinusValues(data_source_type.DoubleLiterals)
points.getDataSourceTypeForErrorBarsCustomValues().setDataSourceTypeForYPlusValues(data_source_type.DoubleLiterals)
points.getDataSourceTypeForErrorBarsCustomValues().setDataSourceTypeForYMinusValues(data_source_type.DoubleLiterals)
i = 0
while i < points.size()
points.get_Item(i).getErrorBarsCustomValues().getXMinus().setAsLiteralDouble(i + 1)
points.get_Item(i).getErrorBarsCustomValues().getXPlus().setAsLiteralDouble(i + 1)
points.get_Item(i).getErrorBarsCustomValues().getYMinus().setAsLiteralDouble(i + 1)
points.get_Item(i).getErrorBarsCustomValues().getYPlus().setAsLiteralDouble(i + 1)
i +=1
end
pres.save(data_dir + "ErrorBarsCustomValues.pptx", Rjb::import('com.aspose.slides.SaveFormat').Pptx)
puts "Added custom error bars values for chart, please check the output file."
end
|