Jump to content

Dynamic Form, Grid and Charts


gerardocrisci

Recommended Posts

You can create a demo where a grid interacts with a chart?

click bars <=> select row.

 

Does anyone know how to do?

 

How you can use the events of the grid and the graph?

Thank you

 

look at this example extjs 4:

 



Dynamic Form, Grid and Charts

Showing companies information in a grid. Selecting a row will highlight the bar corresponding to that company and fill in the form with the company data. A radar chart will show the company information. You can update the information in the form to see it change live in the grid, bar chart and radar charts


 

post-2430-0-21819200-1484090834_thumb.jpg

Link to comment
Share on other sites

Hi,

 

Can you try to analyze this fast solution for now?!:

 

For example,

We have the following components on the form:

 

1. UniDBGrid1 (with dataset) ...

2. UniChart1 (with UniBarSeries1) ...

3. UniButton1...

 

UniButton1Click:

procedure TMainForm.UniButton1Click(Sender: TObject);
var
  i: Byte;
begin
  UniDBGrid1.DataSource.DataSet.First;
  for I := 0 to 9 do begin
    UniBarSeries1.Add(UniDBGrid1.DataSource.DataSet.Fields[5].Value, 
                      UniDBGrid1.DataSource.DataSet.Fields[2].Value // <- interaction with this value (Index = 2)
    );
    UniDBGrid1.DataSource.DataSet.Next;
  end;
  UniDBGrid1.DataSource.DataSet.First;
end;

UniDBGrid1 -> ClientEvents -> ExtEvents -> fn select:

function select(sender, record, index, eOpts)
{
    var sitem;
    MainForm.UniChart1.chart.series.items[0].items.forEach(function(item) {
        if (item.storeItem.data.LL === record.data[2]) {
            sitem = item
        }
    });
    if (sitem) {
        var series = MainForm.UniChart1.chart.series.get(0);
        series.highlight = true;
        series.unHighlightItem();
        series.cleanHighlights();
        series.highlightItem(sitem);
        series.highlight = false;
    }
}

UniChart1 -> ClientEvents -> ExtEvents -> [Ext.chart.Chart [chart]] -> fn chart.boxready:

function chart.boxready(sender, width, height, eOpts)
{
    this.series.items[0].addListener('itemmousedown', function(el) {
        var series = this.chart.series.get(0);
        series.highlight = true;
        series.unHighlightItem();
        series.cleanHighlights();
        series.highlightItem(el);
        series.highlight = false;

        var rec = MainForm.UniDBGrid1.getStore().findRecord('2', el.storeItem.data.LL);
        if (rec) {
            MainForm.UniDBGrid1.getSelectionModel().select(rec);
        };
    })
}

post-906-0-04352800-1484117259_thumb.png

 

Best regards.

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...