a programmatic way to add vertical and/or horizontal line to the chart? - vba

I wrote this up to showcase how to create 2 charts on the same worksheet programmatically.
http://blog.oppoin.com/cookbooks/buttons-forms-and-charts/lesson-25a-2-datasets-of-10-data-points-each-draw-2-graphs-in-2-charts/
I received a request from a student to show how I can also add a vertical or a horizontal line programmatically to the charts.
I googled around but I can only find manual ways as described by John Peltier.
Was wondering if there is a programmatical way to do this.

you can manipulate a single Series object and its properties, thus you can give it a specific chart type thereby enabling you to add a line vertically (column diagram) or horizontally (same value for all X values, thick line chart type. or 2 stacked column series with the bottom one hidden).
So what you do is add a Series object to your Chart object and give it values and chart types so it shows as a line (horizontally or vertically).
It can be quite complicated, but also very simple, which depends on your current chart at hand and how fancy you want this to be.
PS: I see in your blog you don't declare your Subs Public or Private, which might be a good thing to do anyway...

Related

How to adjust the point at which skeleton css shifts it's boxes?

I have a site built using the responsive Skeleton CSS framework (http://getskeleton.com) but when viewing on a phone in portrait mode, three columns across is automatically adjusted so the boxes are vertically stacked rather than all on one line. This has been fine in general but in one particular instance when the boxes have very little content, I need them to stay horizontal - all in one row/on one line. I cannot see anywhere in the css file where this is adjustable though?!
I ended up going old school and creating one twelve column row and putting the column divs inside a td tag each. I then applied some conditional padding at the different breakpoints. Sometimes, very occasionally, you still can't beat a table in my humble opinion!

Determine the size of chart bar in flutter

I am trying to create a chart that displays the data that came from the api that is supposed to be like this image
as for the date and the size of the columns, no matter how many data are coming
I have two problems:
1- I don't know Make the widget flexible so that the column always appears the same size
2- I don’t know. Make the date the same as what is needed. It is displayed in the same form in the API
how can I fix it
For making a widget flexible and appear the same size you can use BoxConstraints by adding Container or SizedBox as parent widget and defining height and width.

What class does Qt designer use to edit the properties of UI elements?

At the moment I'm writing a tool to extract parts of frames of mp4-video files. You draw rectangles on the video and the tool extracts .png-images at regular intervals. Now I want to give the user the ability to edit the properties of individual rectangles they have drawn on the video (exact position, frequency of frame extraction, time frame, etc.). I like the approach that QtDesigner takes for editing ui elements. You can see what I mean in this screenshot i found on the internet
The yellow and green table contains name value pairs for the different properties of the selected ui element. The table is devided into section depending on what class the property was inherented from. In the Screenshot the green part is inherented from MarbleWidget. The yellow part is inherented form a different class. I want each division to refer to a different rectangle and the color to match the colour the rectangle is drawn in on the screen.
I've tried using QTreeView, QTableView, QToolBox and QTableWidget but none of these - to my knowledge - offer putting QWidgets in the "value" part of the table. In the screenshot you can see tick boxes for example. In my case I would want to use a range slider. Does anyone know what class is used to Implement this table?
I think you'll find it difficult to use the designer classes in a normal application.
See qtpropertybrowser for a properties editor.
See setIndexWidget for a static widget. As it says, use QItemDelegate for dynamic widgets. Note that the specific item subclasses have their own methods like QTableWidget.setCellWidget.

Modify Z-index on Series object in Excel 2010

I am using excel 2010.
I have a chart diagram on which i put a rectangle to surround the highest column bar.
In order to make things more readable, i would like to place this rectangle on the chart but NOT in front of the lines/bars/etc...It has to be behind them.
Shape objects (like my rectangle) have a ZIndex property than can be modified in order to achieve that. Thing is, it seems impossible to put that behind the elements of my chart, nor the chart itself.
The main reason is because Chart objects and Series objects (which are the columns inside my chart) doesn't have a Z-Index property.
Is there a way which could allow me to achieve this ? Other than modifying ZIndex property ?
You can move the Chart in front of the Shape, or the Shape in front of the Chart. But what you are looking to do is to stuff the Shape behind some components of the chart, but still in front of the chart background.
That, as far as I know cannot be done.
But you can simulate the effect by making the Chart's background and the Plot area transparent (no fill, instead of the default White fill) by simply right clicking and adjusting properties.
Also, you can highlight both the chart and the shape (Ctrl-Multiple Select) and lock the two together so your Shape will look like it's a part of the chart and is behind the components.
Of course, the shape will be behind the whole chart itself (by setting the appropriate Z-value, which you may find by simply clicking on Record Macro and running the formatting once to get sample code) but since the chart's background is transparent and so is the plot area's it'll look as if the rectangle's behind the lines and all.

Dynamically creating multiple chart areas

I am creating a program which given some data files, creates charts based on these files. Rather than creating multiple charts, I have chosen to create multiple chart areas in a loop and add the various data to the chart areas. When using some sample data, which is small, the program creates 3 chart areas within a chart and works fine.
However using larger data, the program creates the chart areas but because there are over 10 chart areas to create, they do not fit into the size of the chart and also are aligned vertically rather than horizontally.
What I would like to do is increase the size of the chart fitting in all the chart areas for large data, aligning all the chart areas vertically and allowing the user to view all the chart areas via a scroll bar, since there will be a lot of chart areas using the real data files, any help will be appreciated.
The below are examples of alignment types you can switch to
Chart1.ChartAreas(0).AlignmentOrientation = AreaAlignmentOrientations.Horizontal
Chart1.ChartAreas(0).AlignmentOrientation = AreaAlignmentOrientations.Vertical
As for a scroll bar, the chart control doesn't support scroll bars. What I would do is have my original chart contained in some sort of panel/tab [any container that supports scroll bars] and then is number of charts required reaches a certain level add another chart below your original and then allow the container to build the scroll bar
'when charts required is now 5 create new chart
If Chart1.ChartAreas.Count =4 Then
Dim OverflowChart As New Chart
'add a new chart below your current chart and let the container
'have the scroll bar and not your chart control
End if
I managed to figure it soon after I posted here which is ironic. For the sake of anyone with similar problems in the future. The way I did it was to:
- Add a scrollbar to the form
- Make the blank chart as big as possible to fit whatever data which was going to be used
- Manually set the position of each chart area using ChartArea.Position and changing the posY for each chart in a loop
This worked great and gave me a lot of control as to how big I wanted the chart areas since ChartAreas.Position also has a width and height attribute and allowed me to easily align the chart areas horiziontally using the y coordinates of each chart area.