rashmi_k28 Posted October 17, 2008 Share Posted October 17, 2008 I am getting as error as Object of class LinePlot could not be converted to string in line number..... The code is $i=0; foreach($param as $p){ $lineplot.$i = new LinePLot($values[$p]); $lineplot.$i->SetFillColor($color[$p]); $lineplot.$i->SetLegend($legend[$p]); $i++; } The above code should be similar to $lineplot0=new LinePlot($values['bw']); $lineplot1=new LinePlot($values['rf']); // Add the plot to the graph $graph->Add($lineplot0); $graph->Add($lineplot1); If the number of parameters in the array increases like the lineplot2,lineplot3....... should be dynamic and new instance has to be created. How can I do it Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted October 17, 2008 Share Posted October 17, 2008 This doesn't work: $lineplot.$i You could do something like this: ${'lineplot'.$i} Though you might be better off using an array. Quote Link to comment Share on other sites More sharing options...
rashmi_k28 Posted October 17, 2008 Author Share Posted October 17, 2008 Same error I am getting as Object of class LinePlot could not be converted to string Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.