Excel: Adding a Connector Line In a Chart (Have to Use a Macro)? - formatting

So I'm working on this chart in Excel, and the chart looks like two sides of a triange, like the picture at the link below:
http://a.imageshack.us/img832/6207/triangle.png.
I'd like to make a line (like, with an autoshape for example) that connects the 2 endpoints to form a triange; ie a line going from coordinates (4,1) to (4,5). I tried doing this by creating a seperate data series in excel with the coordinates of the connecting line, like:
4,1
4,2
4,3
4,4
4,5
However, in excel, all lines in this chart must have the same x coordinates. Does anyone know how to get a connecting line automatically? Say, with a macro or something? Reason I ask is because I want to be able to change these coordinates, and I want the connecting line to adjust with very little effort (ideally I could write a macro and assign it to a button that when you click it would adjust the connecting line). I have some very limited macro experience, but this is just beyond me. The type of chart I'm using is a standard line chart, where the description given by excel is "Displays trends over time or categories". Anyone know of a good resource or have some advice? Thanks.
PS I solved this problem by changing the chart type to a scatter chart, but this messed up the axes and scale, and required that those be adjusted, so I think adding a line in this manner automatically will be easier.

The scatter chart worked OK.
Used formulas included in the following image.
Perhaps you should include an image showing the problems you found.

Related

Highlighting a part of a series in Candles chart

In my project, I use Apexcharts to display a candle bars chart. Actually, many of them. But I need to be able to highlight a certain part of the candle series on the chart. I couldn't find a way in the docs. Maybe there is, but not that straight, like maybe splitting the series in two and displaying them with different colors?
The latter, though, I've tried and it looks like it breaks the chart, because they dont not even look like a single series anymore, with weird offsets and missing candles.
Can someone at least give a hint how to achieve highlighting on a series?

Creating Diagram from Excel Using VB

Sorry I can't embed images, I have the links instead (... I can only post two links. I have removed the http:// substring from some of the links).
I am looking to take an .csv file (really, any file, as I am generating this myself), and create a Visio (2010) diagram out of it. I have successfully imported the excel sheet to Visio, and can create some rough diagrams, but they are not enough. This is what I'm trying to create. Here are the following tactics I have tried, I prefer the VB method, but whatever works works:
Data Graphics: This is the closest I've gotten to a solution. Basically you create shapes and you can put data in it. Problem is, the style of display available are limited, as we can see here (imgur.com/clTLcxk). After importing the excel sheet, all I had to do was drag and drop to create these shapes. The closest I have gotten is here. However, I really need the outside box (or container, for aesthetic reasons). (Some information here [support.office.com/en-us/article/Enhance-your-data-with-data-graphics-45af64a4-1dcb-4463-9a7e-67709786181c])
VB: I have been using this (msdn.microsoft.com/en-us/library/office/ff959245%28v=office.14%29.aspx). I have ran some of the example code, but I am really lost. I have run some of the example code but the only one I have really gotten to work are useless to me. Also, I don't see any API methods that actually add data to these diagrams!
So how is this done?
I would approach this problem by first defining or finding Visio masters that would the data I'm drawing to the page. In your case it looks like you'd want a master for your Foo items, and one for your Bar items.
So then you'd step through your Bars, then within each Bar you'd have one or more Foos. For each Foo, you would drop that master out, and set the text of the shape to what you want in the blue Foo section (maybe a grouped sub-shape for the Foo master), and then text in the white body.
When stepping through all the Bars, you'd obviously have to drop out a Bar shape and position/size it to contain all the Foos.

Can one use VBA to create a new chart type in PowerPoint?

I don't believe this is possible, but I would love to have confirmation from PowerPoint VBA experts.
I am trying to make a chart in PowerPoint that is essentially a bar graph whose bars have a variable width (i.e. the width of each bar is an input into the chart, as opposed to your classic bar chart, which has a set width for each bar). This is of course not possible in PowerPoint as there is no such chart type for this.
Is it possible to use VBA code to create something like this? I have a hunch that it is not and that I am limited to interacting with the PowerPoint library and the set chart types.
Any insight into this will be greatly appreciated. I am struggling to think of a solution for displaying my data in this particular manner.
Something like the chart in this tutorial: Variable Width Column Charts (Cascade Charts)? It's probably easier to do in Excel, because the data isn't a layer further removed from the chart, but you could follow the same protocol in PowerPoint. This is a manual protocol; I've written VBA to do it in Excel, and I'm going to do the same for PowerPoint when I get a chance.

How do I use Excel to insert blocks into AutoCAD drawings?

I'm trying to use Excel to create AutoCAD drawings. I have a list of product numbers and I'd like to use VBA so that upon hitting a button it will find a block or a drawing file of every product on the list and paste them into an AutoCAD drawing (to a specific point would be a bonus).
So far I've found code that will read from two columns in Excel and will plot a polyline in ACAD using those columns as coordinates. It's very simple but not exactly what I want. Does anyone have suggestions or example code that does something similar? I've found some online using the "ThisDrawing." object but Excel isn't recognizing that so I've reached a stand still. I have all day tomorrow to work on it, so I'll be doing a lot more searching, but any help is definitely appreciated. Thank you
Autodesk provide free downloads on their website so that you can add the VBA IDE into AutoCAD.
Then, inside the AutoCAD IDE you start a new VBA project.
Add a reference to your Excel library so that you can read the Excel spreadsheet.
You need to look up on:
ThisDrawing.ModelSpace.InsertBlock
In the AutoCAD VBA manual. It tells you what various parameters. But they are straightforward - origin, scale, rotation, path to block.
When you call the InsertBlock routine it will create a AcadBlockReference object. You can do any further customization on that object.

SAGE Math - Graphs too big when printing pdf

I'm trying to print out a Sage Worksheet that I created recently. However, when trying to print out the pdf Sage generates for me, the graphs I created take up either a whole page or are too big to fit on a whole page. Is there any way I can resize these graphs to fit no more than half a page?
I've tried the command G.show(figsize=2), which works, but only after compiling on the Sage worksheet.
Any help in this matter is greatly appreciated. Thanks!
I suggest putting (perhaps in a hidden cell)
sage.plot.graphics.Graphics.SHOW_OPTIONS['figsize']=2
at the top (or bottom) of your worksheet. This should globally change these, once you have evaluated your cells again.
However, you are right that the size you create is the size you get. I suppose that is a feature in some sense...