1

Application Layout

This is my sample application layout

What i am trying to achieve is plot the real time values graph in the embedded browser.In the net i got a candlestick graph using d3js which suits my purpose.It call a javascript function taking json object as argument.(This json construction i will create in my application using json c++ library based on the DB data)

Backgound:

Realtime values is published to DB by an external application.When the user select the "Source" from the combo box.and click on Draw button real time garph is ploted.

Workflow:

When the user clicks the "Draw" button ,my application queries the DB and created a json object.Till here i am able to do.Now i need to call the javascript function to display the graph in the embedded browser.This part am not getting how to achieve.I checked another cef example where there is a button in the webpage.When user clicke that button cef call the V8 execute function and displays the text in the browser.But here i dont have any such button or events happening from the browser.I really need to develop this functionality.Can some please guide me through this..If my requirement is not clear please let me il explain again

Note: am using VS2010 on windows 8

  • If you have a programming question then ask. For example *"how do I run a javascript function?"* or *"how do I send data from Windows application to a web page?"* Your question is probably simple but you complicate it by adding the terms c++, MFC, CEF, V8, json, candlestick, d3js, VS2010, DB, javascript ... – Barmak Shemirani Feb 11 '16 at 09:27
  • am not complicating and the solution is not simple..am trying to explain how the application works and what are the thing i am using – nagaraj sherigar Feb 11 '16 at 12:17

1 Answers1

0

An easy way to do this would be to generate the html (probably including some JavaScript and the Json data) in your Draw-button handler, and then load that html in the embedded browser (no need to create a file each time, just load the html data contained in a string).

I'm not familiar with CEF so I can't give an exact example, but I've been doing something similar with the IE embedded browser in the past.

CefSharp seems to have a function LoadHtml() for that - not sure what function to call from C++.

There should also be a way to call that JavaScript function from within your handler, but then, where/how should it get the Json data?

On the other hand, if the chart isn't too complex, you could as well draw it yourself and avoid an integrated browser altogether.

Community
  • 1
  • 1
Danny_ds
  • 11,201
  • 1
  • 24
  • 46