Hello,
We use Chart to display info on a screen in the entry of our company. the computer is automatically started eachmorning without user interaction.
Via a timer we display some forms with different graphs.
The first graph, linechart is always good.
But the 2 next graphs are of type "StackColumnchart". These graph are not good. We checked the data submited to the graph, it's ok (via a simple databinding or adding series manually).But we only have 2 columns (without datas) on graph (columns by default) and we have a strange thing on the legend.
If we don't touche the computer all the days, these 2 graphs are always bad.
We if we use the mouse ont the computer and make some click on the graph, the next time we display the graph, it's good. and all the other graph are always good.
Do you have idea ? or workaround ?
Thx
Hello ,
I am glad to hear that you were able to find solution for your issue.
Please let me know if you need any further assistance on this matter.
We find a workaround.
If we simulate a mouse+click (setcursorpos+sendmessage) at the start of our software, the graphs are good.
seems that when ther is no "user" interaction, windows don't call all the ("paint") event you use to draw graph ?
When we click, the current graph isn't redraw. But all other graph after are ok.
I tryed invalidate but without result.
Here my code :
private void Slide2_Load(object sender, EventArgs e) { try { couleurs.Add("serie1", Color.Red); couleurs.Add("serie2", Color.Blue); couleurs.Add("serie3", Color.Green); ... DataTable dt = access.getSQLData(); ultraChart1.ChartDrawItem += ultraChart1_ChartDrawItem; ultraChart1.Legend.Font = new Font(FontFamily.GenericSerif, 30); ultraChart1.Legend.Margins.Top = 200; ultraChart1.Legend.Margins.Bottom = 230; ultraChart1.DataSource = dt; // Or these 2 lines replaced by manual adding see below ultraChart1.DataBind(); ((IChartComponent)this.ultraChart1).Invalidate(CacheLevel.LayerLevelCache); } catch (Exception exc) { } }
private void ultraChart1_ChartDrawItem(object sender, Infragistics.UltraChart.Shared.Events.ChartDrawItemEventArgs e) { try { Text t = e.Primitive as Text; if (t != null) { if (t.Path == "Border.Title.Grid.X") { try { DateTime dt = DateTime.Parse(t.GetTextString()); t.SetTextString(dt.ToString("MM/yyyy")); } catch (Exception exc) { } } if (couleurs.ContainsKey(t.GetTextString())) { Infragistics.UltraChart.Shared.Styles.LabelStyle lab = t.GetLabelStyle(); lab.FontColor = couleurs[t.GetTextString()]; lab.Font = new Font(FontFamily.GenericSerif, 30); t.SetLabelStyle(lab); } } if (string.IsNullOrEmpty(e.Primitive.Path) || e.Primitive.Path.EndsWith("Legend") == false) { return; } } catch (Exception exc) { } }
// or manual adding to test :
ultraChart1.Series.Clear(); NumericSeries Serie = new NumericSeries(); for (int i = 0; i < dt.Rows.Count; i++) { Serie = new NumericSeries(); Serie.Label = dt.Rows[i]["Day x"].ToString(); Serie.Points.Add(new NumericDataPoint(float.Parse(dt.Rows[i]["serie1"].ToString()), "serie1", false)); Serie.Points.Add(new NumericDataPoint(float.Parse(dt.Rows[i]["serie2"].ToString()), "serie2", false)); Serie.Points.Add(new NumericDataPoint(float.Parse(dt.Rows[i]["serie3"].ToString()), "serie3", false)); ultraChart1.Series.Add(Serie); }
Mouse interaction causes redrawing of the graph, which makes me think that you have made some custom adjustment in FillSceneGrph event or some other event that requires customer interaction. I assume that you may need to “refresh” chart drawing after binding the chart ((this.uc_chart as IChartComponent).Invalidate(CacheLevel.LayerLevelCache)), but without sample I only could make guesses. Is it possible to upload simple sample that demonstrates this issue in order to review your code and to investigate this further.
I am waiting for your feedback.