<font color='black' size='2' face='Arial, Helvetica, sans-serif'><style>.AOLWebSuite .AOLPicturesFullSizeLink { height: 1px; width: 1px; overflow: hidden; }.AOLWebSuite a { color: blue; text-decoration: underline; cursor: pointer; }.AOLWebSuite a.hsSig { cursor: default; }.AOLWebSuiteM1 { margin: 10px 20px; }.AOLWebSuiteM2 { margin: 5px; }.AOLWebSuiteM3 { margin: 10px; }.dmItemSelected { padding: 2px ! important; text-decoration: none ! important; color: rgb(255, 255, 255) ! important; background-color: rgb(101, 101, 101) ! important; }</style>



<div id="AOLMsgPart_0_2ae4be89-3cd2-459e-83de-c29b47b16ef4" style="margin: 0px; font-family: Tahoma,Verdana,Arial,Sans-Serif; font-size: 12px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">

<pre style="font-size: 9pt;"><tt>I'm having trouble writing a simple Basic macro to extend a chart's X-axis. The </tt><font size="2"><font face="Arial, Helvetica, sans-serif"><br>
</font></font><tt>bottom of the chart starts off looking like this:<br>
<br>
|           |<br>
|-----------|<br>
1   2   3   4<br>
<br>
My macro is:<br>
<br>
Sub Main<br>
Dim Doc As Object <br>
Dim Charts As Object <br>
Dim Chart as Object <br>
Doc = ThisComponent<br>
Charts = Doc.Sheets(0).Charts <br>
Chart = Charts.getByIndex(0).EmbeddedObject<br>
Chart.Diagram.XAxis.Max = Chart.Diagram.XAxis.Max + 4<br>
End Sub<br>
<br>
and in the end, I want the bottom of the chart to be:<br>
<br>
|             |<br>
|-------------|<br>
1 2 3 4 5 6 7 8<br>
<br>
Instead, I get<br>
<br>
|           |<br>
|-----------|<br>
1234<br>
<br>
I'm sure the problem has something to do with the fact that the Format > Data <br>
Ranges... menu item's content remains unchanged, i.e., stays<br>
<br>
$Sheet1.$A$1:$A$5<br>
<br>
instead of changing to<br>
<br>
$Sheet1.$A$1:$A$9<br>
<br>
which gives the chart the appearance I want. Any ideas re modules, services, <br>
methods to get/set the chart's data range? TIA,<br>
<br>
Jonathan<br>
<br>
<br>
<br>
<br>
 <br>
<br>
-- <br>
For unsubscribe instructions e-mail to: <a href="mailto:users+help@global.libreoffice.org">users+help@global.libreoffice.org</a><br>
Problems? <a href="http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/" target="_blank">http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/</a><br>
Posting guidelines + more: <a href="http://wiki.documentfoundation.org/Netiquette" target="_blank">http://wiki.documentfoundation.org/Netiquette</a><br>
List archive: <a href="http://listarchives.libreoffice.org/global/users/" target="_blank">http://listarchives.libreoffice.org/global/users/</a><br>
All messages sent to this list will be publicly archived and cannot be deleted<br>
<br>
</tt></pre>
</div>
 



<div style="font-family: helvetica,arial; font-size: 10pt; color: black;">


<div id="AOLMsgPart_1_3380a4e5-539e-4b9b-8502-b4263ab05b8a">





<div> <br>



</div>







<div> <br>



</div>







<div> <br>



</div>







<div style="font-family: helvetica,arial; font-size: 10pt; color: black;">-----Original Message-----<br>



From: Jonathan Levi <drjlevi6@aol.com><br>



To: users <users@global.libreoffice.org><br>



Sent: Sun, Nov 11, 2012 12:55 pm<br>



Subject: [libreoffice-users] Macro Problem: Extending a Chart's X-axis<br>



<br>












<div id="AOLMsgPart_0_2ae4be89-3cd2-459e-83de-c29b47b16ef4" style="margin: 0px; font-family: Tahoma,Verdana,Arial,Sans-Serif; font-size: 12px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">

<pre style="font-size: 9pt;"><br>
<br>
<br>
<br>
I don't know if this is the right list to query, but I'm having trouble writing <br>
<br>
<br>
<br>
a simple Basic macro to extend a chart's X-axis. The bottom of the chart starts <br>
<br>
<br>
<br>
off looking like this:<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
|           |<br>
<br>
<br>
<br>
|-----------|<br>
<br>
<br>
<br>
1   2   3   4<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
My macro is:<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
Sub Main<br>
<br>
<br>
<br>
Dim Doc As Object <br>
<br>
<br>
<br>
Dim Charts As Object <br>
<br>
<br>
<br>
Dim Chart as Object <br>
<br>
<br>
<br>
Doc = ThisComponent<br>
<br>
<br>
<br>
Charts = Doc.Sheets(0).Charts <br>
<br>
<br>
<br>
Chart = Charts.getByIndex(0).EmbeddedObject<br>
<br>
<br>
<br>
Chart.Diagram.XAxis.Max = Chart.Diagram.XAxis.Max + 4<br>
<br>
<br>
<br>
End Sub<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
and in the end, I want the bottom of the chart to be:<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
|             |<br>
<br>
<br>
<br>
|-------------|<br>
<br>
<br>
<br>
1 2 3 4 5 6 7 8<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
Instead, I get<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
|           |<br>
<br>
<br>
<br>
|-----------|<br>
<br>
<br>
<br>
1234<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
I'm sure the problem has something to do with the fact that the Format > Data <br>
<br>
<br>
<br>
Ranges... menu item's content remains unchanged, i.e., stays<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
$Sheet1.$A$1:$A$5<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
instead of changing to<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
$Sheet1.$A$1:$A$9<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
which gives the chart the appearance I want. Any ideas re modules, services, <br>
<br>
<br>
<br>
methods to get/set the chart's data range? TIA,<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
Jonathan<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
 <br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
-- <br>
<br>
<br>
<br>
For unsubscribe instructions e-mail to: <a href="mailto:users+help@global.libreoffice.org">users+help@global.libreoffice.org</a><br>
<br>
<br>
<br>
Problems? <a href="http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/" target="_blank">http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/</a><br>
<br>
<br>
<br>
Posting guidelines + more: <a href="http://wiki.documentfoundation.org/Netiquette" target="_blank">http://wiki.documentfoundation.org/Netiquette</a><br>
<br>
<br>
<br>
List archive: <a href="http://listarchives.libreoffice.org/global/users/" target="_blank">http://listarchives.libreoffice.org/global/users/</a><br>
<br>
<br>
<br>
All messages sent to this list will be publicly archived and cannot be deleted<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</pre>
</div>



 <!-- end of AOLMsgPart_0_2ae4be89-3cd2-459e-83de-c29b47b16ef4 -->

</div>




</div>

 <!-- end of AOLMsgPart_1_3380a4e5-539e-4b9b-8502-b4263ab05b8a -->
</div>

</font>