Web Forms :: Binding / Rebinding Data To Chart For 3.5
Jun 16, 2010
I m using two radio buttons, The binding of the data to chart switches according to the radio button selection, but it shows only the data that is selected for the first radio button
I have a DevExpress WebChart Control that binds to a DataTable. The chart control renders fine from the DataTable until I try to import data from a details view(i think the chart control renders before the detailsview?).
Here is three renderings.
Chart 1. just rendering from the datatable
Chart 2 The sqldatasource gets its para. from the values of two label controls to render the detailsview. The detailsview renders fine
Chart 3, the problem comes in when I try to extract the values from the DetailsView to populate the Chart, I loose the value. I am assuming the the datatable is built before the rendering of the detailsview? Lost at this point.
I'm trying to build a chart in my application which will act as a client for an ASP.NET 3.5 web service that I created. The error I get is as follows:
Series data points do not support values of type System.Data.DataViewManagerListItemTypeDescriptor only values of these types can be used: Double, Decimal, Single, int, long, uint, ulong, String, DateTime, short, ushort.
I've tried various ways to resolve this but can't. This error points at the chtStats.DataBind() line in the code below:
I am able to dynamily bind my grid to the cube based off the facillity I have selected. Now, if a facility has multiple cubes, I want the users to switch between the two cubes dynamicly, so I have created a drop down list showing their cubes and the ones that they can select. Currently I'm been trying several things in order to "rebind" the data but they don't seem to be working, so I figured I would attach my code to see if anyone Had a good idea.
If I make the cube change then switch back over to change facility and then back to the page, the new cube will load. So I have to find a way to do it in the one step rather then have them navigate to another page and then back again. Perhaps auto navigate them to a page and have that page send them back etc... Anyway here is the code: I first bind the data via the page_prerender call
[Code]....
Then the code drops down into the LoadCube(FacilityID) sub routine
[Code]....
Then here is the setup for the subroutine that will call the page load/ should change the cube to the correct cube.
I have a GridView and Formview attached to the same ObjectDataSource.
Everything is working ok so far.
If I enter new search criteria and click "Search", both the GridView and FormView rebind properly to the ObjectDataSource results. And I am able to page through the FormView records and they match the GridView records above.
When I click a sort link in the GridView, the ObjectDataSource returns the correct results based on the header link's commandName of 'Sort' and the CommandArg of 'SortExpression'.
The only thing wrong now is on the sort, the formview records do not reflect the reversing of the sorted record order. If I page through the FormView the records remain in the same order.
Why does the FormView not recognize the ObjectDataSource's changed results on the sort post back (even if it is only the sortExpression parameter of my ODS select method).
How do I get the FormView to rebind to the new ODS result set? I have called formview.DataBind() from every event I can think of. That does not seem to work either.
I have a text box in a FormView that I use to display the return value from the stored procedure that I'm using to maintain the data. For assorted reasons, I'm not able to use the built in ability of the FormView to manipulate the data.
I have the following code at the end of the procedure that calls the stored procedure. It is a snippet that omits the bulk of the procedure.
[Code]....
As is, the label text is updated with the message. However, when I uncomment out the code that manipulates the SQL Data Source and rebinds the FormView, the label text is NOT updated. I can't figure out why it craps out.
1) AdvisoryMessageText is declared at the class level for the code behind, so it should be retaining the value across all of the procedures as their caloled.
2) TextBoxAdvisoryMessage is contained within the FormView EditTemplate.
I am working with a formview edititemtemplate. Currently in my page load, i have some stuff that would show or hide certain panels based on dropdownlist values. These dropdown values get binded during page load. I need to be able to change the values/dropdowns, without rebinding the old data, and updating the visibility of the panels based on predefined rules.
I have experimented with putting my formview.databind() in page load if isnotpostback, in prerender, in prerender if isnotpostback. I have tried my rules (ex if ddlState.selectedvalue = "DE" then pnlDelaware.visible = "true") in the page load, and the page render. I'm just not sure how to get the stars aligned here. The closest i have come is having the databind in the pageload if notispostback, and the rules in the prerender. However I get an error "dropdownlist has a SelectedValue which is invalid because it does not exist in the list of items.
I have a Microsoft ASP.NET chart control. When I bind it to SQL data, it displays nothing. I used a DataList to bind the same data and there are results. Here is the code. What am I doing wrong?
(p.s. the code is below)
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">
The chart on my project is populated click of a button using Chart1.DataSource = The data the chart displays depends on the selection made from a series of drop down lists before the button is clicked. I need to be able to create the chart, then be able to change the selections of the drop down lists and click the button again to show the new data but I am getting the error "A chart element with the name 'element name' already exists in the 'SeriesCollection'" Do I need to "unbind" the data/series before re-binding and resetting the properties of the chart each time the button is pressed?
I have an issue in using dot net chart control. In chart last column is not completely shown which give bad appearance and on right side of chart it looks like TickMark are enabled. I set MajorTickMark of AxisY2 disabled but still tick marks on right side.
I have a drop downlist,and next to it there is an MS bar chart.i want to change the datate of the MS chart ,once the user selects another year from the dropdownlist.
When the page loads ,the chart displays the default year(2011) and it works.The problem is that is does not change the data when you select another year from the dropdownlist.
I am using MS Chart control (3.5), and have a requirement where I need to display 2 pie charts. The datapoints for the pie charts is set programatically. My doubts are as follows:
1. Can I display both the pie charts in a single chart control and area, or do I have to use two controls? (Currently I am using two controls)
2. How can I maintain the same size for both the pie charts? This is my main concern, since the pie sizes keep changing, depending on the number of datapoints. I tried using custom properties like "MinimumRelativePieSize", but it's not working.
i'm trying to create a stacked bar chart on a vb web form using vs2010.My data source returns:
Error in Functionality Awaiting on Supplier
1IMT IssuesmActive6
IMT Issues,Awaiting on Supplier
2,IMT Issues,Awaiting on User 4
IMT Issues Closed 120
Login / Password Active
But I can't get this into a stacked chart. I know I must have to do quite a bit of work declaring what the series are and soforth, or having a different dataset but can't find any documentation on it.A link to some documentation or an example of a stacked chart from an sql datasource would be much appreciated.
I started using the awesome chart controls with my asp.net apps recently and so far they've been nothing short of breath taking. Right now I have a weird problem, on the first load of my page, the chart control appears correctly and the tooltip is correct, however, when I update it with new data, the chart displays correctly, but the tooltips are for the previous set of data.
I hope this makes sense. The first time I load the chart, the pie chart segments and tooltips are correct, after a partial postback (to get the new data), the pie chart segments are correct but the tooltips are for the previous data set.
Basically once the tooltips are set the first time, they can't be updated after that without a full page postback.
Here's how I set the tooltip:
[Code]....
Anyone else noticed this behaviour and have a work around?
Currently my only workaround is to check for a partial postback and not render the tooltip, which I'd rather not do as the tooltip display actual statistical data as opposed to the pie itself (which uses percentages).
I created a GridView that uses a custom paging method that allows for alphabetical paging. I seem to be having some problems now rebinding the GridView after a delete occurs. The row is deleted, it's just that the rebinding doesn't happen so to the user it looks like the delete failed. Been over and over my code and can't understand why. See the final block which is supposed to fire on the GridView1_ItemDeleted event.
What's the difference between binding for example a column called ("Name") in both cases ? and is there's any performance difference ?1- Assigning the data in the mark-up
2- defining a control object for every control inside the repeater ItemTemplate and find it and then assign the data in the column "Name" to ite.Item.FindControl("Name_Lbl")
In order to add pie chart into my website, but i want to remove black border and add % sign to the numbers showing graph and also want to set colours in pie chart based on my website theme.
im trying to create simple pie chart using the MS Chart controls. When my pie chart gets rendered in the browser i get padding around the pie chart that i cant get rid of. i would like the pie chart to sit up against the edge of the image with no padding or margin. in my code below the padding is highlighted in blue. i.e Chart1.BackColor = System.Drawing.Color.Blue;
<script type="text/C#" runat="server"> protected void Page_Load(object sender, EventArgs e) { //Set the chart type Chart1.Series["Series1"].ChartType = SeriesChartType.Pie; //add points Chart1.Series["Series1"].Points.AddY(12); Chart1.Series["Series1"].Points.AddY(45); Chart1.Series["Series1"].Points.AddY(67); //set back color of chart object Chart1.BackColor = System.Drawing.Color.Blue; //set back color of chart area Chart1.ChartAreas["ChartArea1"].BackColor = System.Drawing.Color.Green; } </script> <asp:Chart ID="Chart1" runat="server"> <Series> <asp:Series Name="Series1" ChartType="Pie"> </asp:Series> </Series> <ChartAreas> <asp:ChartArea Name="ChartArea1"> </asp:ChartArea> </ChartAreas> </asp:Chart>
I'm trying to put Google's BarChart and PieChart both the client side version, and i'm experiencing some problems with the labels over the pie and the labels on the left of the vertical axis (of the bar chart).
I checked the code a lot of times and it seems to be like that you can see in the examples.I've tried the same page on Firefox and Chrome and it shows the labels without problems.If i try the examples on IE8 the labels are shown but not in my page.Sincerely I've not any idea where to start to fix this thing.
If its not possible with the "chart" control that comes in System.Web.Helpers assembly, then can someone point me how to do this with asp.net control for webforms in a MVC project