AJAX :: Populate Control Toolkit Line Chart Using SQL Server Database
Feb 20, 2013
I work with a charline (ajax control toolkit) and I want to manipulate from code behind but I do not really know how! I have an example but the data are in the aspx code.
<ajaxToolkit:LineChart ID="LineChart1" runat="server"
ChartWidth="450" ChartHeight="300" ChartType="Basic"
ChartTitle="United States versus European Widget Production"
CategoriesAxis="2007,2008,2009,2010,2011,2012"
ChartTitleColor="#0E426C" CategoryAxisLineColor="#D08AD9"
I am currently making a line chart of Ajax control toolkit referring to an article [URL] .....
It works fines as described. My question is how to reverse Y axis of the line chart.
I need to place 1 (not 0) at the top of Y axis and biggest number near the bottom with some margin from axis X. The described chart is biggest number neat the top and 0 at the bottom.
I followed the article found in below link. When i run the page, only one line gets generated according to the values retireved last. URL....
C# string query = string.Format("SELECT CHAR(CDATE, ISO),CSCUNITPRICE FROM UNITZ.DAILYLOG where fundcode = 'BAL'"); DataTable dt = GetData(query); string[] x = new string[dt.Rows.Count]; decimal[] y = new decimal[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++)
<asp:Chart ID="ChartAlertes" runat="server" Width="500px"> <Titles> <asp:Title Text="Nombre d'alertes et leurs status en fonction des filtres renseignés" BorderColor="Black" Alignment="TopCenter"> </asp:Title> </Titles>
[code]...
I display 2 Points (2 columns) in the Chart Control and I change the color of the each Points with :
But sometimes, I have only 1 Point to display or nothing at all on the Chart. So I'd like to check If there are some Points before to put the color of each Point.
For example :
if (ChartAlertes.Series[0].Empty == false) { //... }
but the graph shows on the X axis only that 18, 38, 41
for (int k = 0; k < semaine.Count(); k++) { Chart4.Series["Nombre de points terminés"].Points.AddXY(nbr_num_semaine_av[k], nbr_points_Termin[k]); Chart4.Series["Nombre Total d'element"].Points.AddXY(nbr_num_semaine_av[k], nbr_element.Count()); } Chart4.Series["Nombre de points terminés"].ChartType = SeriesChartType.Line; Chart4.Series["Nombre Total d'element"].ChartType = SeriesChartType.Line; Chart4.Series["Nombre de points terminés"].IsXValueIndexed = true; Chart4.Visible = true;
In the "LineChart", everytime last "y-axis" point is going out of graph (i.e., somewhere in the footer of x-axis)
X-axis Y-axis
3.4 5.2
5.3 7
2 8.7
1) like in above table, all the point will plot except the last x-axis and y-axis points. Also, y-axis value = 8.7 goes away from graph and comes in the footer of x-axis line.
2) like if x-axis = 3, y-axis=6, then 6 goes out of the graph and comes in footer of x-axis line.
But this problem occurs only when Im using SELECT query for a "particular Id" i.e.,
SELECT x,y from Table1 where Id='Gaug9' and DeletionDate is null
If I will remove where Id=' ' then it will work fine. But I need to plot graph based on particular Id's.
I am Getting the following error using the Numeric UpDown Control from Ajax Control Toolkit. Assembly 'AjaxControlToolkit, Version=3.0.30512.20315, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' contains a Web resource with name 'AjaxControlToolkit.NumericUpDown.NumericUpDownBehavior.debug.js', but does not contain an embedded resource with name 'AjaxControlToolkit.NumericUpDown.NumericUpDownBehavior.debug.js'.
I have created an application in Microsoft Visual studio 2005. And I have used Ajax control tool kit version 3.031106.0. It works fine in my local system. When I hosted this on the server,I am getting this following error.
"Could not load file or assembly 'AjaxControlToolkit, Version=1.0.10606.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' or one of its dependencies"
I am using following server side code to save the data from ASP.NET Control toolkit Editor to the database It follows with the HTML Code The problem is that, data is saved successfully. But it is saved twice. Main problem is this server side event is fired twice. How can i prevent it from firing twice?
Server side code Imports System.Data.SqlClient Partial Class Administrator_Calendar Inherits System.Web.UI.Page Protected Sub BtnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnAdd.Click Try Dim dbobj As New db Dim i As Integer = 0 Dim rdr As SqlDataReader = dbobj.selectQuery("select max(srno) from calendar") If rdr.HasRows = True Then rdr.Read() i = rdr.Item(0) End If rdr.Close() dbobj.insertQuery("insert into calendar values (" & i + 1 & " , '" & Me.Txt_dt.Text & "' , '" & Me.Editor1.Content & "')") dbobj = Nothing Catch ex As Exception End Try End Sub End Class HTML CODE <%@ Page Language="VB" MasterPageFile="~/MasterPages/Admin_AftrLogin.master" AutoEventWireup="false" CodeFile="Calendar.aspx.vb" Inherits="Administrator_Calendar" Title="Excel Crop Care Ltd. / Administration Section / Manage Calendar..." %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor" TagPrefix="cc2" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server"> <div> <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0"> <cc1:TabPanel runat="server" HeaderText="Selected Dates" ID="TabPanel1"> <ContentTemplate> <asp:GridView ID="Gridview1" runat="server" AutoGenerateColumns="False" DataKeyNames="srno" DataSourceID="SqlDataSource1"> <Columns> <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True"> <ItemStyle Width="20%" /> </asp:CommandField> <asp:BoundField DataField="srno" HeaderText="No." ReadOnly="True" SortExpression="srno"> <ItemStyle Width="10%" /> </asp:BoundField> <asp:BoundField DataField="date" HeaderText="Date" SortExpression="date"> <ItemStyle Width="30%" /> </asp:BoundField> <asp:BoundField DataField="description" HeaderText="Description" SortExpression="description" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DataConnectionString %>" SelectCommand="SELECT * FROM [calendar]" UpdateCommand="Update calendar set date=@date,description=@description where srno=@srno" DeleteCommand="Delete from calendar where srno=@srno"></asp:SqlDataSource> </ContentTemplate> </cc1:TabPanel> <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Add New"> <ContentTemplate> <table> <tr> <td width="30%"> Date : </td> <td> <asp:TextBox ID="Txt_dt" runat="server" Height="16px" Width="170px" CausesValidation="True" Font-Names="Verdana" ForeColor="#666666"></asp:TextBox> <asp:ImageButton runat="Server" ID="Image1" ImageUrl="../Images/Calendar_scheduleHS.png" AlternateText="Click to show calendar" /><br /> <cc1:CalendarExtender ID="Txt_dt_CalendarExtender" runat="server" DaysModeTitleFormat="dd/MM/yy" Enabled="True" Format="dd/MM/yy" TargetControlID="Txt_dt" PopupButtonID="Image1"> </cc1:CalendarExtender> <cc1:TextBoxWatermarkExtender ID="Txt_dt_TextBoxWatermarkExtender" runat="server" Enabled="True" TargetControlID="Txt_dt" WatermarkText="DD/MM/YY"> </cc1:TextBoxWatermarkExtender> <cc1:MaskedEditExtender ID="Txt_dt_MaskedEditExtender" runat="server" MaskType="Date" CultureDateFormat="dd/MM/yy" Enabled="True" TargetControlID="Txt_dt" Century="2000" UserDateFormat="DayMonthYear" Mask="99/99/99"> </cc1:MaskedEditExtender> </td> </tr> <tr> <td colspan="2"> <asp:Label ID="Lbl_msg" runat="server" Text="Enter description in the editor below :"></asp:Label> </td> </tr> <tr> <td colspan="2"> <cc2:Editor ID="Editor1" runat="server" Height="350px" /> </td> </tr> <tr> <td colspan="2" align="center"> <asp:Button ID="BtnAdd" runat="server" Text="Add" OnClick="BtnAdd_Click" Width="75px" CssClass="btn" /> <asp:Button ID="Btn_Rem" runat="server" Text="Remove" OnClick="BtnAdd_Click" Width="75px" CssClass="btn" /> </td> </tr> </table> </ContentTemplate> </cc1:TabPanel> </cc1:TabContainer> </div> </asp:Content>
I just installed Ajax Toolkit. The controls are available in my Toolbox, but when I insert them in a page, Visual Studio underlines them with the error message "unknown server tag".
I googled the problem and found several ideas :
check if the DLL is in Bin folder check if ajaxToolKit tags prefix is registered in web.config and make sure I'm not using a different prefix in my pages check if the DLL is registered in the pages with <% @ Register ... %>
Unfortunately all of this is fine, but I still can't get the controls to work. Is something else missing ?
EDIT : My environment is ASP.Net 2.0, Ajax Extensions 1.0, Ajax Toolkit 1.0.20229, Visual Studio 2005
On my X Axis, I have months. The chart shows up to 11 points, i.e. Jan - Nov of the same year, but when I add 12 points (Jan - Dec), it will do an auto label thing and change the interval for every 4 months.
How can I change the graph so that it shows 12 months before it does the auto labels?
Here is the server control code I am currently using.
am using VS 2010.I am new to this (AJAX RAD Controls/AJAX RAD Charts).I am having an xml file having 3 tables.Now my requirement is to plot a Stacked bar Chart dynamically retrieving values from different tables.
I have retrive values from different table into One Datatable named "ValuesToDisplay"
I am very new to .NET platform (from a PHP background) and I am developing a simple multi-step online form. The user can come back and edit the form after they have initially completed it.User clicks edit form. The information saved in the database is retrieved and populated in the form elements like textbox, dropdown box, image files. And this is all inside a wizard control.
I can do this in a gridview using datasource and databind but the datasource doesn't seem to work with wizard.