Cakephp 3 autorender9/5/2023 ![]() And in the following code, we will use $fontFolder variable to set font files. We set font folder directory using CakePHP's build-in constants.Take note how we specify pData.class and pChart.class file path.īecause pData and pChart are not using standard ".php" extension for its file names, we have to specify its files path when using App::import function. Use App class to import class files into this action.Because pChart has a function to output the image to the browse and set its content type accordingly, we do not need to set up any layout and view file for this action.It does not need a model for this tutorial, so set $uses value to be null."tahoma.ttf", 8 ) $Test -> drawLegend ( 45, 35 ,$DataSet -> GetDataDescription (), 255, 255, 255 ) $Test -> setFontProperties ($fontFolder. "tahoma.ttf", 10 ) $Test -> setGraphArea ( 40, 30, 680, 200 ) $Test -> drawGraphArea ( 252, 252, 252, TRUE ) $Test -> drawScale ($DataSet -> GetData (),$DataSet -> GetDataDescription (), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2 ) $Test -> drawGrid ( 4, TRUE, 230, 230, 230, 70 ) // Draw the line graph $Test -> drawLineGraph ($DataSet -> GetData (),$DataSet -> GetDataDescription ()) $Test -> drawPlotGraph ($DataSet -> GetData (),$DataSet -> GetDataDescription (), 3, 2, 255, 255, 255 ) // Finish the graph $Test -> setFontProperties ($fontFolder. ![]() 'Fonts' //5 // Dataset definition $DataSet = new pData $DataSet -> AddPoint ( array ( 1, 4, 3, 2, 3, 3, 2, 1, 0, 7, 4, 3, 2, 3, 3, 5, 1, 0, 7 )) $DataSet -> AddSerie () $DataSet -> SetSerieName ( "Sample data", "Serie1" ) // Initialise the graph $Test = new pChart ( 700, 230 ) $Test -> setFontProperties ($fontFolder. 'pData.class' )) App :: import ( 'Vendor', 'pChart', array ( 'file' => 'pchart'. autoRender = false //3 App :: import ( 'Vendor', 'pData', array ( 'file' => 'pchart'.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |