Merge branch '#143_select2source' into develop
This commit is contained in:
commit
78c5475619
|
@ -18,8 +18,6 @@ namespace Gtk.CairoChart {
|
||||||
|
|
||||||
public Series[] series = {};
|
public Series[] series = {};
|
||||||
|
|
||||||
protected LineStyle selection_style = LineStyle ();
|
|
||||||
|
|
||||||
public Chart () {
|
public Chart () {
|
||||||
bg_color = Color (1, 1, 1);
|
bg_color = Color (1, 1, 1);
|
||||||
}
|
}
|
||||||
|
@ -463,6 +461,14 @@ namespace Gtk.CairoChart {
|
||||||
process_legend (LegendProcessType.DRAW);
|
process_legend (LegendProcessType.DRAW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LineStyle selection_style = LineStyle ();
|
||||||
|
|
||||||
|
public virtual void draw_selection (double x0, double y0, double x1, double y1) {
|
||||||
|
set_line_style (selection_style);
|
||||||
|
context.rectangle (x0, y0, x1 - x0, y1 - y0);
|
||||||
|
context.stroke();
|
||||||
|
}
|
||||||
|
|
||||||
protected int axis_rec_npoints = 128;
|
protected int axis_rec_npoints = 128;
|
||||||
|
|
||||||
protected virtual void calc_axis_rec_sizes (Axis axis, out double max_rec_width, out double max_rec_height, bool is_horizontal = true) {
|
protected virtual void calc_axis_rec_sizes (Axis axis, out double max_rec_width, out double max_rec_height, bool is_horizontal = true) {
|
||||||
|
|
|
@ -244,6 +244,8 @@ int main (string[] args) {
|
||||||
plot_chart3 (chart3);
|
plot_chart3 (chart3);
|
||||||
plot_chart4 (chart4);
|
plot_chart4 (chart4);
|
||||||
|
|
||||||
|
chart1.selection_style = LineStyle(Color(0.3, 0.3, 0.3, 0.7), 1);
|
||||||
|
|
||||||
var da = new DrawingArea();
|
var da = new DrawingArea();
|
||||||
da.set_events ( Gdk.EventMask.BUTTON_PRESS_MASK
|
da.set_events ( Gdk.EventMask.BUTTON_PRESS_MASK
|
||||||
|Gdk.EventMask.BUTTON_RELEASE_MASK
|
|Gdk.EventMask.BUTTON_RELEASE_MASK
|
||||||
|
@ -418,16 +420,8 @@ int main (string[] args) {
|
||||||
/*var ret = */chart.draw();
|
/*var ret = */chart.draw();
|
||||||
|
|
||||||
// user's post draw operations here...
|
// user's post draw operations here...
|
||||||
if (mouse_state == MouseState.DRAW_SELECTION) {
|
if (mouse_state == MouseState.DRAW_SELECTION)
|
||||||
context.set_source_rgba (0.5, 0.5, 0.5, 0.7);
|
chart.draw_selection (sel_x0, sel_y0, sel_x1, sel_y1);
|
||||||
context.set_line_join(Cairo.LineJoin.MITER);
|
|
||||||
context.set_line_cap(Cairo.LineCap.ROUND);
|
|
||||||
context.set_line_width(1);
|
|
||||||
//context.set_dash(null, 0);
|
|
||||||
context.rectangle (sel_x0, sel_y0, sel_x1 - sel_x0, sel_y1 - sel_y0);
|
|
||||||
//context.fill();
|
|
||||||
context.stroke();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;//ret;
|
return true;//ret;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue