Redrawn Chart

I have a chart drawn on a html page. This chart refreshes at intervals by javascript function.
In which I do a chart.clearAll() and then redraw the chart with new values.

This al works fine, except that the labels get darker with each refresh. This because the labels are not redrawn. Is there a way to redraw the chart labels individually?

Hello,

labels must be cleared on clearAll(). Could you provide some information about chart version that you are using ?

Suite v4.03 standard

Could you attach a demo that reproduces the problem ?

The complete code , including the database, css, scripts, etc is a bit to big to include.
I did include the relevant function is, which is called every hour.
Also the chart is drawn on a very simple jquery based Tab frame.
When the chart tab is selected this function is also called.

When this function is called I do see a complete redraw taking place on the tab, with exception of the two labels ‘Celsius’ and ‘Hour’ These two become more black with every call to the function.


function grid() {

if (typeof window.chart !== ‘undefined’ ) { window.chart.clearAll(); }
window.chart = new dhtmlXChart(
{
view: “line”,
padding:{
bottom:75
},
origin:0,
container: “chart1”,
value: “#data4#”,
tooltip: “#data4#”,
label: “”,
yAxis:{
start:0,
end:40,
step:5,
title:“Celsius”
},
xAxis:{
title: “Hour”,
template: “#data0#”
}
}
);
chart.addSeries(
{
line:{ color:"#B56AB5" },
value:"#data3#",
tooltip: “#data3#”
});

    var mygrid = new dhtmlXGridObject("gridbox1");			//Container id for grid
    mygrid.setImagePath("dhtmlx/codebase/imgs/");			//Path yo table images
    mygrid.setHeader("Time,Date,Valid,Temp1,Temp2");		//Colom names
    mygrid.setInitWidths("80,80,50,70,70");				//Table Colom width
    mygrid.setColTypes("ro,ro,ro,ro,ro");				//Set coloms to READ ONLY
    mygrid.setSkin("dhx_skyblue");					//Set skin
    mygrid.init();
    mygrid.loadXML("scripts/connector.php", function(){
    chart.parse(mygrid,"dhtmlxgrid");
   });

}

clearAll() method removes only elements that relate data. After clearAll() you should call method that loads data into an existent chart, and not create a new chart. If you need to rebuild the chart, you should call destructor() method instead of clearAll()

if (typeof window.chart !== 'undefined' ) { window.chart.destructor(); window.chart = new dhtmlXChart({ ...

or

if (typeof window.chart !== 'undefined' ) { chart.clearAll(); chart.parse(...); } else { window.chart = new dhtmlXChart({ ...

Thanks, your solution nr.2 worked like a charm!