ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Can't show two different charts in a single page.
Posted by techsoft on Sep-22-2015 20:05
Hi Peter,

I tried to load two different charts (Finance and custom click) in a single page. But it
shows  finance chart on both place and vice versa. I am using separate id for the chart
images. Given below is the script used to display.

<script>
function ftk_stk_cmp(){
var stock_name = $("#stock_name").val();
if(stock_name!=""){
var exp_date = $("#ftkstk_expdate").val();
var instr = "FUTSTK";
//alert(stock_name);
//alert(exp_date);
var urls = 'fut_stk_cmp.php';
$.ajax({
url: urls,
type: "post",
data:
"symbol="+stock_name+"&instr="+instr+"&exp_date="+exp_date,//default for all
success: function(result){
       //alert(result);
    $("#cmpdata").html(result);
    
}
});

var url = "<?php echo $siteurl; ?
>/stocks_potter/ChartDirector/phpdemo/future_stock.php?";
//alert(url)
     url =
url+"TickerSymbol="+stock_name+"&exp_date="+exp_date+"&TimeRange=90&ranged
ata=1&ChartSize=L&Volume=1&ParabolicSAR=0&LogScale=0&PercentageScale=0&Char
tType=CandleStick&submit2=&Band=None&avgType1=SMA&movAvg1=10&avgType2=S
MA&movAvg2=15&movAvg3=20&movAvg4=25&Indicator1=&Indicator2=&";
//alert(url);
  //Now we update the URL of the image to update the chart
$("#ChartImage").attr('src',url);

//Monthly revenue
  //we encode the values of all form elements as query parameters
var url2 = "<?php echo $siteurl; ?
>/stocks_potter/ChartDirector/phpdemo/customclick.php?";
url2 =
url2+"TickerSymbol="+stock_name+"&exp_date="+exp_date+"&instr="+instr;
// alert(url2);
//Now we update the URL of the image to update the chart
   $("#customchart").attr('src',url2);


}

}
</script>


Thanks
Techsoft

  Re: Can't show two different charts in a single page.
Posted by Peter Kwan on Sep-23-2015 02:46
Hi techsoft,

From your code, it is not clear to me what is "#customchart" and "#ChartImage", and what
exactly do customclick.php and future_stock.php output? However, from the name
"customclick.php", I guess it tries to create a clickable chart. If this is the case,
"#customchart" may not be a chart image <IMG>. It may be an <IFRAME>. Also, the
"customclick.php" creates the chart image but does not output the chart image. It outputs
HTML. The HTML contains the <IMG> tag which probably uses "getchart.php" to output the
chart image.

You mentioned you are using separate id for the chart images. As the chart images are
created in "customclick.php" and "future_stock.php" and stored in session variables. So are
the id in "customclick.php" different from that in "future_stock.php"?

Note that the id is not the id in the code you attached, please that code does not create,
output, or store the chart. It is the session id used "customclick.php" and
"future_stock.php", which creates and stores the chart.

If you need further help, is it possible to inform me the charting part of the code in
"customclick.php" and "future_stock.php"?

Regards
Peter Kwan

  Re: Can't show two different charts in a single page.
Posted by techsoft on Sep-23-2015 12:09
Attachments:
Hi Peter,
Given below is the code where I am trying to show the charts.

<div style="width:100%">
<div >

<iframe  width='100%' height='500'  frameborder="No" scrolling="No"
id="ChartImage" ></iframe>


</div>
</div>



   <div class="clearfix"></div>


   <div class="technical_chart">

<div style="width:100%">
<div>
   <iframe  width='100%' height='800'  frameborder="No" scrolling="No"
id="customchart" ></iframe>
</div>
  </div>

also please check the attached files.

Thanks,
Techsoft
customclick.php
customclick.php

6.64 Kb
future_stock.php
future_stock.php

38.17 Kb

  Re: Can't show two different charts in a single page.
Posted by Peter Kwan on Sep-23-2015 13:49
Hi techsoft,

The two charts you have is using the same id "chart1", so they overwrite each others and
display the same image. To solve the problem, please change one of the chart to use
another id (such as "chart2", "abc", "customclick", etc).

Hope this can help.

Regards
Peter Kwan

  Re: Can't show two different charts in a single page.
Posted by techsoft on Sep-24-2015 13:45
Hi Peter,
To be honest I made this change already before I am posting this issue but it was not
working and I don't know why?. But now it seems to be working perfect.

Thanks
Techsoft