lewis_leeheng Posted April 20, 2007 Report Share Posted April 20, 2007 Hi Frank, Can I only allow editing datagrid on certain column only. Please advised.. and show me some coding. Thank Regards Lewis Link to comment Share on other sites More sharing options...
Frank Posted April 20, 2007 Report Share Posted April 20, 2007 You need to capture the DataChangedByUser client side event in your JavaScript. Here is the sample code: <SCRIPT LANGUAGE="JavaScript" FOR="Chart1" EVENT="DataChangedByUser(sender, e)"><!-- // Prevent changes to second series if (e.Series == 1) e.Handled = true;--></SCRIPT> Note: The .NET control requires FULL TRUST in order to fire events to IE. Link to comment Share on other sites More sharing options...
lewis_leeheng Posted April 22, 2007 Author Report Share Posted April 22, 2007 Hi Frank, Thank you for your reply. But I would like to allow user to edit those column hightlighted in RedBox as below Only and do not allow user to edit the label for The Series Labels ( Series 1, Series 2, Series 3) and X Labels (1,2,3,4,5....10). Are we able to use coding to control the above features on the Datagrid? If possible, could you please help to provide some examples? Kindly advice. Thank You. Regards Lewis Link to comment Share on other sites More sharing options...
Frank Posted April 23, 2007 Report Share Posted April 23, 2007 e.Series will be -1 for the row headings and e.Point will be -1 for the column headings. So simply check for those conditions. Link to comment Share on other sites More sharing options...
lewis_leeheng Posted April 24, 2007 Author Report Share Posted April 24, 2007 Hi Frank, Thank you for your reply. I would to ask is there whether when user after edit the Data Point value on the datagrid, Point Labels on the charts also changes at the same time. The Point Labels i would like to display out on my customize point labels. Are we able to use coding to control the above features on the Point Labeling? Below is my Test Program to try out on this customize Point Labels but it doesnt work on it. If possible, could you please help to provide some examples? ********************************************************************************************************************************** <SCRIPT LANGUAGE="JavaScript" FOR="Chart1" EVENT="DataChangedByUser(sender, e)"> // Prevent changes to series & Coloumn Header if (e.Series == -1 || e.Point == -1) e.Handled = true; else { //alert(" S-" + e.Series + " P-" + e.Point); Chart1.Points( e.Series,e.Point ).PointLabels.Format = FormatValueToCustomPL( e.Value ); // Format the Current Value to Point Labeling Chart1.Points( e.Series,e.Point ).PointLabels.Angle = 90; Chart1.Points( e.Series,e.Point ).PointLabels.Alignment = StringAlignment.Near; Chart1.Points( e.Series,e.Point ).PointLabels.LineAlignment = StringAlignment.Far; Chart1.Points( e.Series,e.Point ).PointLabels.Visible = True; } </SCRIPT> ********************************************************************************************************************************** Kindly advice. Thank You. Regards Lewis Link to comment Share on other sites More sharing options...
Frank Posted April 24, 2007 Report Share Posted April 24, 2007 The default point label format shows the value of the point and it will update when this value is changed. I don't understand what you are trying to do with this code. Link to comment Share on other sites More sharing options...
lewis_leeheng Posted April 25, 2007 Author Report Share Posted April 25, 2007 Hi Frank, Thank you for your reply. The default point label format only show the value of the point, but i need to convert this point values to time usages description for each point. Below is my sample of the chart. Q1 - Is there possible when DataChangedByUser it also able to perform convert point values to time usages description and display on Point Label at the same time ? Q2 - When Chart1_UserCallback is trigger, is it possible that we able to get the DataChangedByUser current point value from Datagrid? Q3- When UserCallBack it seens like automatic reload back to previous data but not update the lastest (user entered value) point value. Why it not able to update the lastest point value on chart? If possible, could you please help to provide some examples? ********************************************************************************************************************************** Test.aspx <chartfx7:chart id="Chart1" runat="server" height="450px" width="900px" RenderFormat=".NET" OnUserCallback="Chart1_UserCallback"> <script type="text/javascript" language="javascript"> function Charfx_DatagridOnChanged(iposIndex) { SFX_SendUserCallback('Chart1', iposIndex, false); } </script> <SCRIPT LANGUAGE="JavaScript" FOR="Chart1" EVENT="DataChangedByUser(sender, e)"> // Prevent changes to second series if (e.Series == -1 || e.Point == -1) e.Handled = true; else { var posIndex = e.Series + ':' + e.Point; Charfx_DatagridOnChanged(posIndex); } </SCRIPT> Test.aspx.vb '<summary> To UserCallBack Perform ChartFX Events </summary>Protected Sub Chart1_UserCallback(ByVal sender As Object, ByVal e As ChartFX.WebForms.UserCallbackEventArgs) Handles Chart1.UserCallback Dim arPos(2) As String Dim jParam As String = e.Param Dim jSeries, jPoint As Integer Dim test As Double Dim splitter1 As Char() = {":"c} arPos = jParam.Split(splitter1) jSeries = Convert.ToInt16(arPos(0)) jPoint = Convert.ToInt16(arPos(1)) 'Chart1.Titles.Add(New TitleDockable(e.Param)) e.Result = DateTime.Now.ToString() Chart1.Series(0).PointLabels.Visible = True test = Chart1.Data(jSeries, jPoint).ToString() Chart1.Points(jSeries, jPoint).PointLabels.Format = FormatValue2TimeDescr (Chart1.Points(jSeries, jPoint).Text) Chart1.Points(jSeries, jPoint).PointLabels.Angle = 90 Chart1.Points(jSeries, jPoint).PointLabels.Alignment = StringAlignment.Near Chart1.Points(jSeries, jPoint).PointLabels.LineAlignment = StringAlignment.Far Chart1.Points(jSeries, jPoint).PointLabels.Visible = True End Sub ********************************************************************************************************************************** Kindly advice. Thank You. Regards Lewis Link to comment Share on other sites More sharing options...
Frank Posted April 30, 2007 Report Share Posted April 30, 2007 I see now. You are in the right track with UserCallback. What I suggest you do is this: 1) Set chart.AllSeries.PointLabels.Format = "%L" This instruct Chart FX to display the Text property in the Point Label. 2) Keep processing the DataChangedByUser now and keep sending the UserCommand event. In the DataChangedByUser event you can get e.Text as the text beign entered. You can pass that back to your UserCommandEvent. For example: var posIndex = e.Series + ':' + e.Point + ':' + e.Text; 3) In your UserCommand event, instead of: Chart1.Points(jSeries, jPoint).PointLabels.Format = FormatValue2TimeDescr (Chart1.Points(jSeries, jPoint).Text) Chart1.Points(jSeries, jPoint).PointLabels.Angle = 90 Chart1.Points(jSeries, jPoint).PointLabels.Alignment = StringAlignment.Near Chart1.Points(jSeries, jPoint).PointLabels.LineAlignment = StringAlignment.Far Chart1.Points(jSeries, jPoint).PointLabels.Visible = TrueDo: Chart1.Points(jSeries, jPoint).Text = <converted time value>; You are going to get the value as entered in the DataGrid from e.Param Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.