# Graph orientation in Excel

**URL:** <https://www.ruby-forum.com/t/graph-orientation-in-excel/75609>\
**Category:** Ruby\
**Created:** [November 11, 2006, 3:19pm UTC](https://www.ruby-forum.com/t/graph-orientation-in-excel/75609 "2006-11-11T15:19:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex-osu3](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/13edae/32.png) [@alex-osu3](https://www.ruby-forum.com/u/alex-osu3)\
**Post date:** [November 11, 2006, 3:19pm UTC](https://www.ruby-forum.com/t/graph-orientation-in-excel/75609/1 "2006-11-11T15:19:59Z")

</div>

Hi guys,

I copy one script as follows to draw a graph. The result is a  
column-based serial, which means I get two lines composed of 3-2-1 and  
10-6-3. My question is how I tell the script so that I get row-based  
serial(3 lines), which are 3-10,2-6 and 1-3. Aslo how do find these  
methods by querying Ruby. I try ri WIN32OLE but don’t get much  
information.

Thanks,

Li

############excel.rb  
require ‘win32ole’

excel = WIN32OLE.new(“excel.application”)

excel[‘Visible’] = TRUE;  
workbook = excel.Workbooks.Add();  
excel.Range(“a1:b1”).Value= [3,10]  
excel.Range(“a2:b2”).Value= [2,6]  
excel.Range(“a3:b3”).Value = [1,3]

ChartTypeVal=4  
excel.Range(“a1:b3”).Select();  
excelchart = workbook.Charts.Add();  
excelchart[‘Type’] = ChartTypeVal;

savefile=‘C:\Ruby\self\excel1.xls’;  
excelchart.Saved(savefile);

excel.ActiveWorkbook.Close(0);  
excel.Quit();

---

<div class="post-metadata">

**Author:** ![alex-osu3](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/13edae/32.png) [@alex-osu3](https://www.ruby-forum.com/u/alex-osu3)\
**Post date:** [November 11, 2006, 3:35pm UTC](https://www.ruby-forum.com/t/graph-orientation-in-excel/75609/2 "2006-11-11T15:35:29Z")

</div>

Li Chen wrote:

> Hi guys,
> 
> I copy one script as follows to draw a graph. The result is a  
> column-based serial, which means I get two lines composed of 3-2-1 and  
> 10-6-3. My question is how I tell the script so that I get row-based  
> serial(3 lines), which are 3-10,2-6 and 1-3. Aslo how do find these  
> methods by querying Ruby. I try ri WIN32OLE but don’t get much  
> information.

Read the Excel documentation? Win32Ole is just an interface to its COM  
API that lets you access those functions.

David V.

---

<div class="post-metadata">

**Author:** ![alex-osu3](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/13edae/32.png) [@alex-osu3](https://www.ruby-forum.com/u/alex-osu3)\
**Post date:** [November 12, 2006, 3:52am UTC](https://www.ruby-forum.com/t/graph-orientation-in-excel/75609/3 "2006-11-12T03:52:15Z")

</div>

David V. wrote:

> Read the Excel documentation? Win32Ole is just an interface to its COM  
> API that lets you access those functions.
> 
> David V.

Thanks and I get it.

Li
