Jump to content

mhmda

uniGUI Subscriber
  • Posts

    1141
  • Joined

  • Last visited

  • Days Won

    157

Posts posted by mhmda

  1. Hi,

     

    It's working greate !

     

    1. the 'OnResize' is an event for the DBGRID in Client Side Events, please follow me:

     

    grd1.jpg

     

     

     

     

     

     

    grd2.jpg

     

     

    Don't forget this line (it's very important):

     

      //validate
      if(sender.columns.length==0) return;
     

  2. Hi,

     

    UniGui using Extjs 4.1.1 and this method has been changed, so I use this to auto resize columns at Client Side:

     

     

    

     function OnResize(sender, adjWidth, adjHeight, rawWidth, rawHeight)
    {
      //get grid new width
      var grd_w=sender.getWidth();
      //validate
      if(sender.columns.length==0) return;
      //auto resize columns
      crnt_w=0.073*grd_w; //Calc width in 7.3%
      crnt_w=Math.floor(crnt_w);
     //change column width: strat from 1 for first column (when indecator is true) otherwize start from 0
     sender.columns[1].setWidth(crnt_w);//first column (0: is the indecator)
    }

    

    

    

  3. Hi,

     

    How can I create a gauge chart?

     

    1. If unigui doesn't support guage chart then how can I insert extjs code (for guage chart) to my application?

     

    2. How can I attach an event (let's say button_click) to object I have created using extjs pure code?

     

     

    guage.jpg

     

    I put this code into htmlframe:

     

    <script language="js">
    generateData = function(n, floor){
           var data = [],
               p = (Math.random() *  11) + 1,
               i;
               
           floor = (!floor && floor !== 0)? 20 : floor;
           
           for (i = 0; i < (n || 12); i++) {
               data.push({
                   name: Ext.Date.monthNames[i % 12],
                   data1: Math.floor(Math.max((Math.random() * 50), floor))
               });
           }
           return data;
       };
       
      
    
       store1 = Ext.create('Ext.data.JsonStore', {
           fields: ['name', 'data1'],
           data: generateData()
       });
       
      
    store1.loadData(generateData(1)); 
    
    var enroll = Ext.create('Ext.chart.Chart', {
           width: 400,        
           height: 140,
           renderTo: 'O20_id-body',
           store: store1,
           axes: [{
               type: 'gauge',
               position: 'gauge',
               minimum: 0,
               maximum: 50,
               steps: 15,
               margin: -10
           }], 
           series: [{
               type: 'gauge',
               donut: true,
               field: 'data1',
               colorSet: ['#FD02EB', '#ddd']
           }]
       });
       
    
    </script>   

  4. You can use this:

     

    * I put the fastreport components in my DataModule.

     

    * I use this code 'Onclick' button.

     

    procedure TfrmMenu.MyFrxShowExp();
    var
      fn:String;
      FormUrlView1:TURLFrame;
    begin
      fn:= 'R-' +FormatDateTime('hhmmss.zzz', Now()) +'.pdf'; // Create a unique name for report.
      DataModule1.frxReport5.PrintOptions.ShowDialog := False;
      DataModule1.frxReport5.ShowProgress:=false;
      DataModule1.frxReport5.PrintOptions.ShowDialog:=false;
      DataModule1.frxReport5.EngineOptions.SilentMode:=True;
      DataModule1.frxPDFExport1.Background:=True;
      DataModule1.frxPDFExport1.ShowProgress:=False;
      DataModule1.frxPDFExport1.ShowDialog:=False;
      DataModule1.frxPDFExport1.FileName := UniServerModule.LocalCachePath + fn;
      DataModule1.frxPDFExport1.DefaultPath := '';
      if Mainform.WebMode then begin
         DataModule1.frxReport5.PrepareReport(); // Create Report
         DataModule1.frxReport5.Export(DataModule1.frxPDFExport1); // Export Report
         FormUrlView1:=TURLFrame.Create(UniApplication);
         FormUrlView1.URLFrm.URL := UniServerModule.LocalCacheURL + fn; // Displayed on UniURLFrame
         FormUrlView1.Show;
      end else begin
         DataModule1.frxReport5.ShowReport();
      end;
    end;

  5. Where I put this code to change bar's color:

     

    var colors = ['rgb(47, 162, 223)','rgb(60, 133, 46)'];
    
       Ext.chart.theme.fancy = Ext.extend(Ext.chart.theme.Base, {
           constructor: function(config) {
               Ext.chart.theme.Base.prototype.constructor.call(this, Ext.apply({
                   colors: colors
               }, config));
           }
       });

     

    and How I link this theme 'fancy' to the chart ? :unsure:

×
×
  • Create New...