Jump to content
JChartFX Community
  • 0

Filter chart


niravbhatt

Question

Hello,

I am a JChartFX licensed user. I am developing a product using JchartFX.

We have a situation where we have one dashboard and different charts in that. We need to filter or change data according to any event or something. Is there any facility in JChartFX to filter data on same charts?
More Explanation of  scenario : if you have one project dashboard containing lots of charts, what would you recommend we do to support more than one project?

Thanks in advance. 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

You can modify any (or all) of the charts after any event captured on the client, e.g.

<body>
<select id="year" onchange="onYearChanged()">
<option value="1997">1997</option>    
<option value="1998">1998</option>    
<option value="1999">1999</option>    
</select><br/>
<div id="ChartDiv" style="width:550px;height:400px;display:inline-block"></div>
</body>

 

JavaScript

function onLoadDoc()
{
    chart1 = new cfx.Chart();
    chart1.setGallery(cfx.Gallery.Bar);
    chart1.setDataSource([10,12,8,9,11]);
    chart1.create("ChartDiv");
}

function onYearChanged()
{
    var selectObj = document.getElementById("year");
    if (selectObj.value == "1997")
        chart1.setDataSource([10,12,8,9,11]);
    else if (selectObj.value == "1998")
        chart1.setDataSource([8,7,12,14,11]);
    else
        chart1.setDataSource([3,4,8,1,12]);
}

Obviously instead of hardcoding data you would either request new data to the server or filter existing data, once you have the data you can invoke setDataSource on the chart to change its data, if necessary you can also change any of the charts visual attributes.

We do not offer any APIs to filter data

Regards,

JuanC

 

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.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   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.

Loading...
×
×
  • Create New...