Add Data Points From Double() Array To Existing Chart Series?
Jun 21, 2012
I have an array of type Double() (1 x n) that I am trying to quickly plot on a graph I've already set up. The only thing I want/need to do is take my array and store it as data points (y-axis values) in the series I already have. What's the best way to do this? Also, will the data points that are plotted change as my array changes, and if not, how would I replot those new points and get rid of the old points?
I have an ASP Chart (v4) which displays the data I need perfectly. I want it to show labels at the top of the data points and I am having some difficulty with it. Here is my code that works for both series but does not display the labels:
I am importing data from an excel file, and it is stored in a dataset. The data is then filtered with a binding source, and that data is outputted into a datagridview. The filtered data in the datagridview contains data for 2 identification numbers. I want to graph each ID number in a chart on their own bar, in either a stacked bar graph, or a double bar graph.
I am having trouble assigning each series to an ID number: I have tried using multiple binding sources, but each seems to override the previous giving too much/too little data. I have tried using multiple datagridviews, however I cannot assign more than one datagridview as the datasource for the chart. The code I have pasted below outputs a double bar graph, however both bars graph the same ID number.
Private Sub dataButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dataButton.Click Try Dim cnRange As String = "provider=Microsoft.Jet.OLEDB.4.0; " & _ "data source='" & strFileName & "';" & _ "Extended Properties=""Excel 8.0; IMEX=1; HDR=No;""" 'moApp.Visible = True [Code] .....
I think my subject sums up what I am interested in knowing. I am looking to create a chart where Series1 is from Table1, Series2 is from Table2 in the given Dataset. My code below doesn't throw any errors, but it appears to be grabbing the data for each series from the first table.
Imports System.Windows.Forms.DataVisualization.Charting Public Class Form1 Public Sub New(ByVal ChartData As DataSet) ' This call is required by the designer. InitializeComponent() [Code] .....
I'm working in VS2010 on a visual basic application. It takes in serial port data, writes it to an access database, and then graphs the data.The data only comes in once every minute, so it's not like I'm building an oscilloscope. Right now, the chart is reading from the database using a table adapter and graphing just fine, so long as I keep the number of records in the database low.If I add too many records to the database, the chart shows a red "X" through it. I've played with changing the axes, but it is still a problem.I don't really need to graph the whole database.The twenty most recent records would suffice.How can I make a chart series with only a small subset of the database in it.Perhaps it cold be populated with a query?
How do I dynamically add or remove a chart series on a WinForm. To date all my MS Charting experience has been dealing with ASP.Net charts with static sql select statment to a SQL Database. In the new project that I have been assigned I have different cities with different amounts of points that they want monitored. One city might have 3 an another might have 5 or 7 so I can't hard code the amount of series that I need. It needs to be set up so the amount of series can be flexible depending on the city selected and then display those points on the chart.
My requirement is to graph (scatter graph) data from 2 arrays. I can now connect the data from the array and use it on the chart. My question is, how do I set the graph's X- and Y- axes to show consistency in their intervals?
I currently have a chart that plots lines of a changing value every time it is called via a timer.
Everything is running as I expected and I am happy, but now I want to be able to press a [STOP] button which will stop the timer and stop the graph from updating, (which I have coded and is now working OK), BUT I then want the code under this [STOP] button to clear everything from the graph, so when I re-start the timer, the graph is cleared and starts plotting fresh points on a clean graph.
The problem I currently have is that when I press the [STOP] button and then press the [START] button, the new lines that get plotted are "added" to the existing lines that are already on the chart, instead of having a new "blank" chart, with no data on it.
So what I am really asking is does anyone know if it is possible to reset a chart clearing everything off it so it is ready to start displaying fresh data?
I was hoping it was something like: "Chart1.Clear" or something simple like that, but I can't seem to find anything that will do it.
The below photo shows that point 4 is connected to point 1 while point 5 is not connected to point 1 according to the flow direction. How can I programme this?
The below code shows the connections between nodes where the row of the matrix represents "FromPoint" and the column represent the "ToPoint".Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase .Load
I am able to place a single series of chart data with my code but I cannot for the life of me figure out how to add a second series. I can add the Series ... I can Select the series but cannot with out errors figure out how to put data the the series' that I am creating ...
I have a set of charts in a form. These are "canned" charts and will only be updated when new data comes in (typically on a monthly basis). I have created each chart by binding (bounding?) a data source to it in VS2010 using the Properties slide out window. I set the DataSource to a data source table that I set up in the .XSD file. In the Series property GUI I have set up the XValueMember and YValueMembers from the available columns in the data table I set in the previous step. I have 6 tables in my DataSet. One table relates to one Chart (Chart1, Chart2, Chart3, etc) in my form.
What I would like to do is programmatically get the data table name from the Chart properties. I have tried doing something like:
ch1Table = Chart1.DataSource.DataMember.ToString
However this fails due to Option Strict disallowing late binding. I am probably missing something obvious here but I cannot see it.
So, how do I get the bound data table name from the set properties of the chart? I am using MSChart Control 4 and VS2010 and building a VB.NET WinForms app.
For each of the 6 charts there is an associated System.Windows.Forms.BindingSource. What I need to do is programmatically get that BindingSource, then get the DataMember (which is the table name I need) for each chart.
Apply a generic template to chart series.[code]Note that the bars are unstyled while the chart seems to style just fine.The documentation regarding built-in .NET charting is woefully thin.Can anyone help me get my generic templates to work?
Im starting to learn how to use the chart control in VB .how you create a "new" column because atm all the time i add series it puts them side by side.Ive looked at the documentation for the control and the examples but they dont seem to cover this , or i could find it .Now how would i assign each series to a new point?So item 1 would go above column 1 and item 2 above column 2 etc.The code i have at the moment is a test code .
Chart1.Dock = DockStyle.Fill For i As Integer = 0 To 10 Dim newSeries1 As New Series[code]..........
Is there is a way to remove the white box around the series label in a chart. I am using the built in chart from the toolbox in Visual Studio 2010. This is the last part I need to finish the appearance of the chart to make it look the way I want.
I am using a button on a form which creates a chart at runtime when the user clicks the button. it works ok for the first time but when I select the button the second time I get a square diagonal box or indexoutofrange Exception.Note: I have another button that clears the series from the chart before reselecting the button that creates the chart.
Below is the code segment
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Static Dim counter As Integer = 0
Im trying to plot the reading of 20 or more thermocouples in a single chart area.But it seems that the build in charting in vb.net can't handle that. My program just crashes when adding a series somwhere between the 14th or 18th series.Anyone know of any setting i can change or a better charting plugin?
imagine an array of data containing a gray scale image and you want the bar chart (say 20x20) to display a section of that image as both the magnitude of the data and its shade of gray. if you were to look vertically down on the 3D barGraph you should see the section of the image. Is this at all possible? The projetc relates to clutter intensity in a radar image if this interests you.
I am trying to build a function that returns a chart. I want to have a parameter to account for times where i may need more than one series. How does one loop through to create multiple series? I would think you would need a variable for each series. The function is below. I would think that if there were 5 series that each of the "Dataseries" variables should have their own name. Do I then refer to them by index only?
I am trying to build a function that returns a chart. I want to have a parameter toaccount for times where i may need more than one series. How does one loop through to createmultiple series? I would think you would need a variable for each series. The function is below. I would think that if there were 5 series that each of the "Dataseries" variables should have their own name. Do I then refer to them by index only? Public Shared Function MakeChart(ByVal form As Form, Optional ByVal numseries As Integer = 0) As Chart
' Add any initialization after the InitializeComponent() call. Dim SampleChart As Chart = New Chart() Dim MainChartArea As ChartArea = New ChartArea()
I am working on an application that ties into a SQL database on the back end. Currently the main form contains a series of combo boxes (Graph type, data format, location, and customer), two date pickers, and a button to launch the selections in a new form. Everything works just fine except there are a couple of things I can't seem to accomplish.
Case Select (with commented out lines for variations attempted):
1) I would like to be able to use some sort of case statement to color the bars in my chart based on value. I have tried approaching this in a couple of different ways but neither of the options seem to work. First, I tried this (the If Not is used because depending on what values are passed to the stored procedure in SQL, different columns will be returned):
Only one series is created with this method, so I can see how/why a Select Case would set all bars the same color. I have also tried creating a series for each row in the returned dataset but it results in 22 bars of different colors, for each of the rows (484 bars):
So is there any way to modify the second set of code there to only select the value from the "Percent TMHB" cell that corresponds with Row(i), rather than ALL values from the "Percent TMHB" column for EACH Row(i)?
2) Since I am drawing/creating these graphs in a new window, is there any way to also create a new timer on the "newFrm" and have the tick refresh the data? I've struggled with this but I feel like it should be easy. Say someone chooses a "TMHB", "Percentage", "Chicago", "All" (Graph type, data format, location, customer) and launches the graph, which opens in a new window, then they want to do "TMHB", "Percentage", "LA", "All" and have both windows up, refreshing automatically throughout the day. Can I somehow store the SelectCommand.Parameters values in the new form/timer so that it will query the database again every 5 minutes?
Example code for the StoredProcedure and creating the new form:
If combo_GraphType.SelectedItem = "TMHB" Then Dim newFrm As New Form Dim newChart As New Chart
Recently I have learned visual basic 2008 express edition and developed programs for data crunching and analysis. The VB 2008 express edition has microsoft visual studio 2008 v. 9.0.30729.1 SP and .NET Framework version 3.5 SP1. Now I want to create x-Y (date-Y value) graphs using the crunched data stored in an array list simulating a data base access. I download and installed the "Microsoft Chart Control for .NET Framework " and try to learn to use it within the VB 2008 express edition using the tutorial. It seems that the chart control did not get installed?
1. Do I need at VB 2008 professional to allow using the chart control? 2. Why after installing chart control, there is no change on the items under the NET components within the Toolbox>ChooseItem>. 3. How do I get to use the chart control under VB 2008 express edition. 4. Any code available to generate versatile graphics without using the chart control? Because the chart control has tons of classes already it seems the best is to just use the existing and downloadable chart control?
In the same class I have Dim WithEvents YMDChart As Chart Dim WithEvents YMDChartArea As ChartArea Then: Public Sub PlotYMD() handles ButtonPlot.click YMDChart = New Chart
But here at line 5 I have an error saying that I am not refering to an existing instance whereas I am.If think it is because at this step the YMDChart is dead even if it is present on my form. I have tried with the declaration "Static" but it is only possible within a method and is incompatible with "with event".
I have an Excel template that contains numerous pre-defined charts and a program that opens this template and collects data used to populate the charts. This works great but I now want to adjust the series length so that the charts only used the data collected (not a range of 32000). I'm trying to iterate through the charts and determine the range for each series of each chart but not having much luck. The snippet below allows me to see the xvalues but does not return any information as to where this data is located. Does anyone know how to extract the range for each series in a chart?
I have a chart in Excel that I'd like to use a subtitle on. There is no SubTitle Property on the chart object, so I looked in the Excel User interface and found that you can only create a sub-title by using a text box. The text box looks like its associated with the chart, not the worksheet, so how would I access that text box from code?
As per this illustration, I'm trying to increase the size of an existing array from 111 to 114 to be consistent with existing code. I need topreserve the existing values and add 3 new items to the end of the existing array of booleans,
I'm creating a simple programming assignment in Visual Basic 2010.(Don't know if it matters, but I'm working in MS Visual Studio.The program consists of two windows forms and a module.Everything works fine except for this one loop I'm trying to use to display whether the answers were "correct" or "incorrect".[code]
I have an global array of points that i want to plot in VB. say X and Y points, and typically they have values of +/-12000. Now I've not done graphics work for a long time and when I did, I used OpenGL with C. Now I need a GUI i'm using VB 2008. Firstly, what's the best method of rendering the array of points? should I use some port of OpenGL? GDI? or what?
Secondly, can I simply print to perhaps a Panel on hit of a button? Thirdly, do I have to place any line drwing code in an "OnPaint" event handler? Finally (for now) if my array represents points in a space much larger than the painting surface, how would I scale and scroll the final image within the the proposed Panel? I look forward to your advice.
I've rewritten my program so it would be more .net friendly (meaning I try to draw in picturebox.Paint event).
I try to use DrawLines using array of points, which are added by user one by one, but I can't figure out how to force my program to only use points that have been set by user and not the whole array.
When I call DrawLines pointing at my array of eg. 10 points and only 5 had been set, I end up with a nice set of lines with the last going to the upper left corner (0,0) and supposedly staying there for 4 more points, which is unacceptable.
I think of using ReDim Preserve each time, but I am not sure if it is the most efficient way to do this.
Anyone can think of something more elegant before I implement this redim monstrosity?