Home » Developing U++ » UppHub » GraphDraw/GraphCtrl
Re: GraphDraw/GraphCtrl [message #54051 is a reply to message #53959] |
Sun, 24 May 2020 13:07 |
|
Pradip
Messages: 109 Registered: February 2019 Location: India
|
Experienced Member |
|
|
Hello Didier,
Need some help. Please see my implementation of CustomData and CustomDataSource, similar to your demo:
namespace Upp {
namespace GraphDraw_ns {
class GanttBar : public CustomData {
private:
int row_num;
const S_ACTIVITIES* act;
RectGraph bar;
// TypeScreenCoord bar_thk = 5;
public:
GanttBar(int row, const S_ACTIVITIES* ac) : row_num(row), act(ac) {
bar.left = act->START_DATE_PL.Get();
bar.right = act->END_DATE_PL.Get();
bar.top = row_num + 0.25;
bar.bottom = row_num + 0.75;
};
virtual ~GanttBar() {};
virtual bool Intersects(const RectGraph& graphView) const {
return graphView.Intersects(bar);
};
virtual bool Contains(const PointGraph& pt) const {
return bar.Contains(pt);
};
virtual void PaintDataPoint(BufferPainter& dw, int scale,
const CoordinateConverter* xCoordConv, const CoordinateConverter* yCoordConv) {
const TypeScreenCoord left = xCoordConv->toScreen(bar.left);
const TypeScreenCoord right = xCoordConv->toScreen(bar.right);
const TypeScreenCoord bottom = yCoordConv->toScreen(bar.top);
const TypeScreenCoord top = yCoordConv->toScreen(bar.bottom);
Rect r(left,top, right, bottom);
ChPaint(dw, r, Yellow());
};
String ToString() const {
return Format("Row num=%i\tActivity ID=%i\tBar=%s", row_num, act->ACT_ID, bar.ToString());
};
};
class GanttBarSeries : public CustomDataSource {
private:
const ArrayCtrl* array;
Array<GanttBar> gantt_bars;
public:
GanttBarSeries() {};
void Link(const ArrayCtrl* ar) {
array = ar;
};
void RefreshBars() {
if(!gantt_bars.IsEmpty()) gantt_bars.Clear();
int n = array->GetCount();
for(int i = 0; i < n; i++) {
GanttBar gb(i, &ActById(array->Get(i, ACT_ID)));
gantt_bars.Add(gb);
}
DUMP(gantt_bars);
};
virtual ~GanttBarSeries() {};
virtual unsigned int GetCount() const {return gantt_bars.GetCount();};
virtual const CustomData& Get(unsigned int dataIndex) const {return gantt_bars[dataIndex];};
virtual CustomData& Get(unsigned int dataIndex) {return gantt_bars[dataIndex];};
};
};
};
You will see that I'm trying to link the Gantt with an ArrayCtrl. The DUMP is showing this:
gantt_bars = [Row num=0 Activity ID=10 Bar=[737830, 0.25] - [737947, 0.75] : (117, 0.5), Row num=1 Activity ID=28 Bar=[737832, 1.25] - [737854, 1.75] : (22, 0.5), Row num=2 Activity ID=29 Bar=[737854, 2.25] - [737856, 2.75] : (2, 0.5), Row num=3 Activity ID=118 Bar=[737856, 3.25] - [737898, 3.75] : (42, 0.5), Row num=4 Activity ID=126 Bar=[737856, 4.25] - [737859, 4.75] : (3, 0.5), Row num=5 Activity ID=127 Bar=[737859, 5.25] - [737862, 5.75] : (3, 0.5), Row num=6 Activity ID=128 Bar=[737862, 6.25] - [737867, 6.75] : (5, 0.5), Row num=7 Activity ID=129 Bar=[737867, 7.25] - [737870, 7.75] : (3, 0.5), Row num=8 Activity ID=130 Bar=[737870, 8.25] - [737881, 8.75] : (11, 0.5), Row num=9 Activity ID=131 Bar=[737870, 9.25] - [737873, 9.75] : (3, 0.5), Row num=10 Activity ID=133 Bar=[737873, 10.25] - [737875, 10.75] : (2, 0.5), Row num=11 Activity ID=134 Bar=[737875, 11.25] - [737879, 11.75] : (4, 0.5), Row num=12 Activity ID=388 Bar=[737879, 12.25] - [737881, 12.75] : (2, 0.5), Row num=13 Activity ID=136 Bar=[737881, 13.25] - [737886, 13.75] : (5, 0.5), Row num=14 Activity ID=137 Bar=[737881, 14.25] - [737883, 14.75] : (2, 0.5), Row num=15 Activity ID=138 Bar=[737883, 15.25] - [737884, 15.75] : (1, 0.5), Row num=16 Activity ID=139 Bar=[737883, 16.25] - [737890, 16.75] : (7, 0.5), Row num=17 Activity ID=140 Bar=[737890, 17.25] - [737895, 17.75] : (5, 0.5), Row num=18 Activity ID=141 Bar=[737895, 18.25] - [737898, 18.75] : (3, 0.5), Row num=19 Activity ID=121 Bar=[737898, 19.25] - [737931, 19.75] : (33, 0.5), Row num=20 Activity ID=143 Bar=[737898, 20.25] - [737901, 20.75] : (3, 0.5), Row num=21 Activity ID=144 Bar=[737901, 21.25] - [737909, 21.75] : (8, 0.5), Row num=22 Activity ID=145 Bar=[737909, 22.25] - [737916, 22.75] : (7, 0.5), Row num=23 Activity ID=148 Bar=[737916, 23.25] - [737924, 23.75] : (8, 0.5), Row num=24 Activity ID=149 Bar=[737924, 24.25] - [737926, 24.75] : (2, 0.5), Row num=25 Activity ID=150 Bar=[737926, 25.25] - [737931, 25.75] : (5, 0.5), Row num=26 Activity ID=123 Bar=[737931, 26.25] - [737939, 26.75] : (8, 0.5), Row num=27 Activity ID=124 Bar=[737939, 27.25] - [737946, 27.75] : (7, 0.5), Row num=28 Activity ID=125 Bar=[737946, 28.25] - [737947, 28.75] : (1, 0.5)]
So the bars are being made alright. In my application (TopWindow) header:
GraphDraw_ns::GanttCtrl gantt;
Upp::GraphDraw_ns::GanttBarSeries ganttBarSeries;
In TopWindow constructor:
ganttBarSeries.Link(&array);
gantt.AddCustomSeries(ganttBarSeries);
And in a callback which refreshes the linked array:
ganttBarSeries.RefreshBars();
gantt.Refresh();
However the gantt chart is always empty, doing FitToData() is also not showing any bar. What am I missing here?
Regards,
Pradip
|
|
|
|
|
GraphDraw/GraphCtrl
By: Didier on Fri, 01 May 2020 12:20
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Fri, 01 May 2020 13:04
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Fri, 01 May 2020 13:30
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Fri, 01 May 2020 13:37
|
|
|
Re: GraphDraw/GraphCtrl
By: koldo on Sat, 02 May 2020 10:16
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sat, 02 May 2020 11:38
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sun, 03 May 2020 15:46
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sun, 03 May 2020 16:08
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sun, 03 May 2020 16:10
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Thu, 07 May 2020 21:10
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Fri, 08 May 2020 09:37
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Fri, 08 May 2020 09:43
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sun, 10 May 2020 14:53
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Wed, 13 May 2020 17:42
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Wed, 13 May 2020 20:51
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Wed, 13 May 2020 21:06
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 14 May 2020 08:16
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 14 May 2020 08:51
|
|
|
Re: GraphDraw/GraphCtrl
By: mirek on Thu, 14 May 2020 09:30
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 14 May 2020 10:01
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 14 May 2020 09:44
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Thu, 14 May 2020 10:57
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 14 May 2020 12:18
|
|
|
Re: GraphDraw/GraphCtrl
By: mirek on Thu, 14 May 2020 13:47
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 14 May 2020 14:15
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Fri, 15 May 2020 13:10
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Fri, 15 May 2020 18:04
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sat, 16 May 2020 10:06
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sat, 16 May 2020 20:51
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sun, 17 May 2020 23:59
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Mon, 18 May 2020 06:10
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sun, 24 May 2020 13:07
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sun, 24 May 2020 20:52
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 28 May 2020 09:23
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 28 May 2020 18:52
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Fri, 29 May 2020 00:00
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Fri, 29 May 2020 17:23
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Fri, 29 May 2020 23:09
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sat, 30 May 2020 12:42
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sat, 30 May 2020 15:45
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sun, 31 May 2020 12:23
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Mon, 01 June 2020 16:15
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sat, 06 June 2020 22:31
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sun, 07 June 2020 14:07
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sun, 07 June 2020 18:49
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 11 June 2020 10:44
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 11 June 2020 12:34
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 11 June 2020 15:53
|
|
|
Re: GraphDraw/GraphCtrl
By: deep on Fri, 12 June 2020 10:31
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sat, 13 June 2020 09:13
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sat, 13 June 2020 23:49
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sun, 14 June 2020 00:09
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sun, 14 June 2020 00:44
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sun, 21 June 2020 12:48
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sun, 21 June 2020 12:53
|
|
|
Re: GraphDraw/GraphCtrl
By: koldo on Sun, 21 June 2020 16:22
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sun, 21 June 2020 16:59
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Mon, 22 June 2020 00:28
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Mon, 22 June 2020 00:41
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Mon, 22 June 2020 14:28
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Mon, 22 June 2020 09:52
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Mon, 22 June 2020 10:35
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Mon, 22 June 2020 12:54
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Mon, 22 June 2020 15:56
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Tue, 23 June 2020 07:29
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Mon, 22 June 2020 13:22
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Mon, 22 June 2020 14:35
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Mon, 22 June 2020 20:52
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Tue, 23 June 2020 09:22
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Tue, 23 June 2020 14:27
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Thu, 25 June 2020 00:10
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 25 June 2020 10:37
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Mon, 29 June 2020 11:34
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Mon, 29 June 2020 12:25
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sat, 11 July 2020 23:31
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sun, 12 July 2020 08:06
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sun, 12 July 2020 10:26
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sun, 12 July 2020 11:57
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sun, 12 July 2020 12:11
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sun, 12 July 2020 12:18
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Tue, 14 July 2020 17:52
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sun, 12 July 2020 13:22
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Tue, 14 July 2020 20:45
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Tue, 14 July 2020 23:18
|
|
|
Re: GraphDraw/GraphCtrl
By: koldo on Wed, 15 July 2020 09:45
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Wed, 15 July 2020 09:57
|
|
|
Re: GraphDraw/GraphCtrl
By: koldo on Wed, 15 July 2020 09:57
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Wed, 15 July 2020 10:01
|
|
|
Re: GraphDraw/GraphCtrl
By: koldo on Wed, 15 July 2020 12:58
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sat, 16 January 2021 07:08
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sat, 16 January 2021 08:04
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sat, 16 January 2021 20:57
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Thu, 21 January 2021 19:55
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sat, 20 March 2021 05:34
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sat, 20 March 2021 20:48
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Mon, 22 March 2021 06:26
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 25 March 2021 05:43
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Thu, 25 March 2021 19:16
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Fri, 26 March 2021 06:19
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Wed, 31 March 2021 10:02
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Wed, 31 March 2021 22:22
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Wed, 31 March 2021 22:32
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 01 April 2021 06:45
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Wed, 07 April 2021 14:51
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Wed, 07 April 2021 18:44
|
|
|
Re: GraphDraw/GraphCtrl
By: Klugier on Wed, 07 April 2021 21:33
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Wed, 07 April 2021 22:33
|
|
|
Re: GraphDraw/GraphCtrl
By: Oblivion on Thu, 08 April 2021 08:53
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 08 April 2021 09:49
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Fri, 09 April 2021 06:37
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Fri, 09 April 2021 14:07
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 15 April 2021 09:21
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Thu, 15 April 2021 14:52
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Mon, 19 April 2021 15:14
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Mon, 19 April 2021 19:42
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Mon, 19 April 2021 21:01
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Fri, 23 April 2021 08:06
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Fri, 23 April 2021 13:00
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Mon, 26 April 2021 12:50
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Mon, 26 April 2021 22:48
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Tue, 27 April 2021 10:11
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Tue, 27 April 2021 20:08
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Tue, 27 April 2021 20:28
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Tue, 27 April 2021 23:33
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Tue, 27 April 2021 23:34
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sun, 02 May 2021 12:43
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Mon, 03 May 2021 23:00
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Tue, 04 May 2021 13:15
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Tue, 04 May 2021 13:17
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Tue, 04 May 2021 19:31
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sun, 02 May 2021 12:31
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Fri, 23 April 2021 08:03
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 15 April 2021 09:25
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Mon, 22 June 2020 14:01
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sun, 16 May 2021 22:30
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sun, 16 May 2021 22:36
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 20 May 2021 10:52
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Thu, 20 May 2021 10:54
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Thu, 20 May 2021 19:45
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Thu, 20 May 2021 22:30
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Wed, 26 May 2021 16:22
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Tue, 01 June 2021 23:23
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Mon, 07 June 2021 10:43
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Mon, 07 June 2021 13:33
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Tue, 08 June 2021 22:28
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Sat, 03 July 2021 06:18
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Sat, 03 July 2021 09:41
|
|
|
Re: GraphDraw/GraphCtrl
By: Pradip on Wed, 12 April 2023 09:12
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Fri, 23 February 2024 18:23
|
|
|
Re: GraphDraw/GraphCtrl
By: Didier on Fri, 23 February 2024 18:26
|
Goto Forum:
Current Time: Sun Apr 28 17:56:26 CEST 2024
Total time taken to generate the page: 0.04816 seconds
|