Reload chart by button without reload all page

Hi , how i can reload chart by pressing on button without reload all page ???

i have 3 buttons , and i want in one

reload charts data
data1.json when pressing button1
data2.json when pressing button2
data3.json when pressing button3

when i pressing button1 function load chart, but when i pressing button2 or button3
data from data2.json overlaps on data from data1.json
how delete old chart , with old data before ???

Hi
Here is a sample for you
chart.zip (864 KB)

thx

You are welcome!
You just need to use the same methods, and chart data and source may be different.

Darya if i want draw another type of chart in this div it’s real ?

Yes, of course!
Bar type sample is below (you can replace it with previous for test):

[code]function doOnLoad(){
formData = [{
type: “settings”,
position: “label-left”,
inputWidth: 100
}, {
type: “input”,
name: “inp1”,
value: 20
}, {
type: “input”,
name: “inp2”,
value: 30
}, {
type: “input”,
name: “inp3”,
value: 40
}, {
type: “button”,
value: “Count”,
name: “btn”,
width: 60
}, {
type: “button”,
value: “Clear”,
name: “btn_cl”,
width: 60
}];
myForm = new dhtmlXForm(“form1”, formData);
pieChart = new dhtmlXChart({
view:“bar”,
container:“chart1”,
value:"#sales#",
label:function(obj){
return obj.sales
},
color:"#color#",
legend:{
width: 75,
align:“right”,
valign:“middle”,
template:"#month#"
},
xAxis:{
template:"’#month#"
},
yAxis:{
title:“Profit”
}
});
my_dataset = [
{ sales: 20, month:“area1”, color: “#ee3639” },
{ sales: 30, month:“area2”, color: “#ee9e36” },
{ sales: 40, month:“area3”, color: “#eeea36” }
];
pieChart.parse(my_dataset,“json”);

            myForm.attachEvent("onButtonClick", function(id){
                if(id=="btn"){
                    my_dataset[0].sales = myForm.getItemValue("inp1");
                    my_dataset[1].sales = myForm.getItemValue("inp2");
                    my_dataset[2].sales = myForm.getItemValue("inp3");
                    pieChart.parse(my_dataset,"json");
                }
                if(id=="btn_cl"){
                    pieChart.clearAll();
                }
            })
        }[/code]