Jump to content
Software FX Community

Is there a function call to initiate a chart click event?


Chris R

Recommended Posts

I've scoured the documentation in vain trying to find a comprehensive list of JavaScript functions that raise chart events. I know of a couple just by sifting through demo source code:

 SFX_SendUserCallBack

SFX_onCallbackReadyDelegate

 Is there one for raising a click event? I've tried SFX_SendClick and SFX_Click but can't get it to work.

 

Also, it would be really helpful if we could have a list of these functions. Thanks!

File 1.zip

Link to comment
Share on other sites

 Hi, you can try this code. This code moves custom grid lines to a position in the chart in which the user has raised the click event:

[On Code Behind]

protected void Page_Load(object sender, EventArgs e)
  {
  if (!IsPostBack)
  {
  Chart1.Gallery = Gallery.Curve;
  CustomGridLine custom1 = new CustomGridLine();
  custom1.Value = 3;
  custom1.Color = Color.DarkBlue;
  custom1.Text = "Limit 1";
  custom1.Width = 2;
  Chart1.AxisX.CustomGridLines.Add(custom1);
  CustomGridLine custom2 = new CustomGridLine();
  custom2.Value = 25;
  custom2.Color = Color.Black;
  custom2.Style = System.Drawing.Drawing2D.DashStyle.Dash;
  custom2.Text = "Alarm Limit 1";
  custom2.TextColor = Color.DarkRed;
  Chart1.AxisY.CustomGridLines.Add(custom2);
  }
  }

 

[ON ASPX]

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
  <title>Untitled Page</title>
</head>
<script language="javascript" type="text/javascript">
  function PaintGridLines(x,y) {
  var chrfx = document.getElementById("Chart1");
  chrfx.AxisX.CustomGridLines.Item(0).Value = x;
  chrfx.AxisY.CustomGridLines.Item(0).Value = y;
  } 
</script>

<script lang="JavaScript" for="Chart1" event="MouseClick(obj, args)">
PaintGridLines(Chart1.AxisX.PixelToValue(args.X),Chart1.AxisY.PixelToValue(args.Y));
</script>
<body>
  <form id="form1" runat="server">
  <div>
  <chartfx7:Chart ID="Chart1" runat="server" RenderFormat=".Net">
  </chartfx7:Chart>
  </div>
  </form>
</body>
</html>

 

Hope this helps.

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for the reply. I discovered the call I was looking for. For anyone else interested in this functionality I will post the command to use in the JavaScript section of your ASPX page:

SFX_PostBack('Chart1','C:P,0,1')

The first parameter ('Chart') is obviously the name of your chart, thus the name of the object that is initiating the postback. The second parameter ('C:P,0,1') I'm not entirely sure about. It appears the 'C:P' portion is a constant, and it might be an acronym for Chart:Pie, which is the type of chart I'm using. The next part, 0, is the series, and the last part, 1, is the point, which is the index of the region clicked on the chart.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...