[chronojump] New jumpsEvolution cairo graph and other improvements on cairo graphs



commit cdfd2a23a8cc13afcfa63a902fc8b88c747b8451
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Jan 8 19:52:01 2020 +0100

    New jumpsEvolution cairo graph and other improvements on cairo graphs

 glade/app1.glade                     | 485 +++++++++++++++++++++++++----------
 src/Makefile.am                      |   3 +
 src/gui/app1/chronojump.cs           |  32 ++-
 src/gui/app1/icons.cs                |   1 +
 src/gui/app1/jumpsDjOptimalFall.cs   |   3 +-
 src/gui/app1/jumpsEvolution.cs       | 140 ++++++++++
 src/gui/app1/jumpsWeightFVProfile.cs |   3 +-
 src/gui/cairo/jumpsEvolution.cs      | 115 +++++++++
 src/gui/cairo/xy.cs                  |  31 ++-
 src/jump.cs                          |   2 +-
 src/jumpsEvolution.cs                | 112 ++++++++
 src/sqlite/jump.cs                   |  55 +++-
 src/sqlite/session.cs                |  61 +++--
 src/utilDate.cs                      |  17 ++
 14 files changed, 880 insertions(+), 180 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index c6037a8a..7c410ffc 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -5017,197 +5017,245 @@ EncoderInertialCapture</property>
                                                   </packing>
                                                 </child>
                                                 <child>
-                                                  <widget class="GtkRadioButton" 
id="radio_mode_contacts_jumps_profile">
-                                                    <property name="can_focus">True</property>
-                                                    <property name="receives_default">False</property>
-                                                    <property name="relief">none</property>
-                                                    <property name="draw_indicator">False</property>
-                                                    <property 
name="group">radio_mode_contacts_jumps_advanced</property>
-                                                    <signal name="toggled" 
handler="on_radio_mode_contacts_jumps_profile_toggled" swapped="no"/>
+                                                  <widget class="GtkHBox" id="hbox199">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="spacing">8</property>
                                                     <child>
-                                                      <widget class="GtkHBox" id="hbox199">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property name="spacing">10</property>
+                                                      <widget class="GtkRadioButton" 
id="radio_mode_contacts_jumps_profile">
+                                                        <property name="can_focus">True</property>
+                                                        <property name="receives_default">False</property>
+                                                        <property name="relief">none</property>
+                                                        <property name="draw_indicator">False</property>
+                                                        <property 
name="group">radio_mode_contacts_jumps_advanced</property>
+                                                        <signal name="toggled" 
handler="on_radio_mode_contacts_jumps_profile_toggled" swapped="no"/>
                                                         <child>
-                                                          <widget class="GtkImage" 
id="image_tab_jumps_profile">
+                                                          <widget class="GtkHBox" id="hbox329">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_tab_jumps_profile">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property 
name="stock">gtk-missing-image</property>
-                                                          </widget>
-                                                          <packing>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
                                                             <property name="position">0</property>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
-                                                          <widget class="GtkLabel" 
id="label_mode_contacts_jumps_profile">
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_mode_contacts_jumps_profile">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="label" translatable="yes">Jumps 
profile</property>
                                                             <property name="justify">center</property>
-                                                          </widget>
-                                                          <packing>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
                                                             <property name="position">1</property>
-                                                          </packing>
+                                                            </packing>
+                                                            </child>
+                                                          </widget>
                                                         </child>
                                                       </widget>
+                                                      <packing>
+                                                        <property name="expand">True</property>
+                                                        <property name="fill">True</property>
+                                                        <property name="position">0</property>
+                                                      </packing>
                                                     </child>
-                                                  </widget>
-                                                  <packing>
-                                                    <property name="expand">False</property>
-                                                    <property name="fill">False</property>
-                                                    <property name="position">3</property>
-                                                  </packing>
-                                                </child>
-                                                <child>
-                                                  <widget class="GtkRadioButton" 
id="radio_mode_contacts_jumps_dj_optimal_fall">
-                                                    <property name="can_focus">True</property>
-                                                    <property name="receives_default">False</property>
-                                                    <property name="relief">none</property>
-                                                    <property name="draw_indicator">False</property>
-                                                    <property 
name="group">radio_mode_contacts_jumps_advanced</property>
-                                                    <signal name="toggled" 
handler="on_radio_mode_contacts_jumps_dj_optimal_fall_toggled" swapped="no"/>
                                                     <child>
-                                                      <widget class="GtkHBox" id="hbox174">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property name="spacing">10</property>
+                                                      <widget class="GtkRadioButton" 
id="radio_mode_contacts_jumps_dj_optimal_fall">
+                                                        <property name="can_focus">True</property>
+                                                        <property name="receives_default">False</property>
+                                                        <property name="relief">none</property>
+                                                        <property name="draw_indicator">False</property>
+                                                        <property 
name="group">radio_mode_contacts_jumps_advanced</property>
+                                                        <signal name="toggled" 
handler="on_radio_mode_contacts_jumps_dj_optimal_fall_toggled" swapped="no"/>
                                                         <child>
-                                                          <widget class="GtkImage" 
id="image_tab_jumps_dj_optimal_fall">
+                                                          <widget class="GtkHBox" id="hbox174">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_tab_jumps_dj_optimal_fall">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property 
name="stock">gtk-missing-image</property>
-                                                          </widget>
-                                                          <packing>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
                                                             <property name="position">0</property>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
-                                                          <widget class="GtkLabel" 
id="label_mode_contacts_jumps_profile2">
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_mode_contacts_jumps_profile2">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="label">Dj optimal fall</property>
                                                             <property name="justify">center</property>
-                                                          </widget>
-                                                          <packing>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
                                                             <property name="position">1</property>
-                                                          </packing>
+                                                            </packing>
+                                                            </child>
+                                                          </widget>
                                                         </child>
                                                       </widget>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">False</property>
+                                                        <property name="position">1</property>
+                                                      </packing>
                                                     </child>
-                                                  </widget>
-                                                  <packing>
-                                                    <property name="expand">False</property>
-                                                    <property name="fill">False</property>
-                                                    <property name="position">4</property>
-                                                  </packing>
-                                                </child>
-                                                <child>
-                                                  <widget class="GtkRadioButton" 
id="radio_mode_contacts_jumps_weight_fv_profile">
-                                                    <property name="can_focus">True</property>
-                                                    <property name="receives_default">False</property>
-                                                    <property name="relief">none</property>
-                                                    <property name="draw_indicator">False</property>
-                                                    <property 
name="group">radio_mode_contacts_jumps_advanced</property>
-                                                    <signal name="toggled" 
handler="on_radio_mode_contacts_jumps_weight_fv_profile_toggled" swapped="no"/>
                                                     <child>
-                                                      <widget class="GtkHBox" id="hbox230">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property name="spacing">10</property>
+                                                      <widget class="GtkRadioButton" 
id="radio_mode_contacts_jumps_weight_fv_profile">
+                                                        <property name="can_focus">True</property>
+                                                        <property name="receives_default">False</property>
+                                                        <property name="relief">none</property>
+                                                        <property name="draw_indicator">False</property>
+                                                        <property 
name="group">radio_mode_contacts_jumps_advanced</property>
+                                                        <signal name="toggled" 
handler="on_radio_mode_contacts_jumps_weight_fv_profile_toggled" swapped="no"/>
                                                         <child>
-                                                          <widget class="GtkImage" 
id="image_tab_jumps_weight_fv_profile">
+                                                          <widget class="GtkHBox" id="hbox230">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_tab_jumps_weight_fv_profile">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property 
name="stock">gtk-missing-image</property>
-                                                          </widget>
-                                                          <packing>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
                                                             <property name="position">0</property>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
-                                                          <widget class="GtkLabel" 
id="label_mode_contacts_jumps_profile3">
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_mode_contacts_jumps_profile3">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="label" translatable="yes">FV 
Profile</property>
                                                             <property name="justify">center</property>
-                                                          </widget>
-                                                          <packing>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
                                                             <property name="position">1</property>
-                                                          </packing>
+                                                            </packing>
+                                                            </child>
+                                                          </widget>
                                                         </child>
                                                       </widget>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">False</property>
+                                                        <property name="position">2</property>
+                                                      </packing>
                                                     </child>
-                                                  </widget>
-                                                  <packing>
-                                                    <property name="expand">False</property>
-                                                    <property name="fill">False</property>
-                                                    <property name="position">5</property>
-                                                  </packing>
-                                                </child>
-                                                <child>
-                                                  <widget class="GtkRadioButton" 
id="radio_mode_contacts_sprint">
-                                                    <property name="can_focus">True</property>
-                                                    <property name="receives_default">False</property>
-                                                    <property name="relief">none</property>
-                                                    <property name="draw_indicator">False</property>
-                                                    <property 
name="group">radio_mode_contacts_jumps_advanced</property>
-                                                    <signal name="toggled" 
handler="on_radio_mode_contacts_sprint_toggled" swapped="no"/>
                                                     <child>
-                                                      <widget class="GtkHBox" id="hbox206">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property name="spacing">10</property>
+                                                      <widget class="GtkRadioButton" 
id="radio_mode_contacts_jumps_evolution">
+                                                        <property name="can_focus">True</property>
+                                                        <property name="receives_default">False</property>
+                                                        <property name="relief">none</property>
+                                                        <property name="draw_indicator">False</property>
+                                                        <property 
name="group">radio_mode_contacts_jumps_advanced</property>
+                                                        <signal name="toggled" 
handler="on_radio_mode_contacts_jumps_evolution_toggled" swapped="no"/>
                                                         <child>
-                                                          <widget class="GtkImage" id="image_tests_sprint">
+                                                          <widget class="GtkHBox" id="hbox324">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_tab_jumps_evolution">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property 
name="stock">gtk-missing-image</property>
-                                                          </widget>
-                                                          <packing>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
                                                             <property name="position">0</property>
-                                                          </packing>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_mode_contacts_jumps_profile4">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label">Jumps / time</property>
+                                                            <property name="justify">center</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                          </widget>
                                                         </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">False</property>
+                                                        <property name="position">3</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkRadioButton" 
id="radio_mode_contacts_sprint">
+                                                        <property name="can_focus">True</property>
+                                                        <property name="receives_default">False</property>
+                                                        <property name="relief">none</property>
+                                                        <property name="draw_indicator">False</property>
+                                                        <property 
name="group">radio_mode_contacts_jumps_advanced</property>
+                                                        <signal name="toggled" 
handler="on_radio_mode_contacts_sprint_toggled" swapped="no"/>
                                                         <child>
-                                                          <widget class="GtkLabel" 
id="label_mode_encoder_analyze3">
+                                                          <widget class="GtkHBox" id="hbox206">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" id="image_tests_sprint">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_mode_encoder_analyze3">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="label" 
translatable="yes">Sprint</property>
                                                             <property name="justify">center</property>
-                                                          </widget>
-                                                          <packing>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
                                                             <property name="position">1</property>
-                                                          </packing>
+                                                            </packing>
+                                                            </child>
+                                                          </widget>
                                                         </child>
                                                       </widget>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">False</property>
+                                                        <property name="position">4</property>
+                                                      </packing>
                                                     </child>
-                                                  </widget>
-                                                  <packing>
-                                                    <property name="expand">False</property>
-                                                    <property name="fill">False</property>
-                                                    <property name="position">6</property>
-                                                  </packing>
-                                                </child>
-                                                <child>
-                                                  <widget class="GtkAlignment" id="alignment29">
-                                                    <property name="visible">True</property>
-                                                    <property name="can_focus">False</property>
                                                     <child>
                                                       <widget class="GtkRadioButton" 
id="radio_mode_contacts_jumps_advanced">
                                                         <property name="can_focus">True</property>
@@ -5220,7 +5268,7 @@ EncoderInertialCapture</property>
                                                           <widget class="GtkHBox" id="hbox50">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">10</property>
+                                                            <property name="spacing">4</property>
                                                             <child>
                                                             <widget class="GtkImage" 
id="image_tests_analyze_general">
                                                             <property name="visible">True</property>
@@ -5249,12 +5297,17 @@ EncoderInertialCapture</property>
                                                           </widget>
                                                         </child>
                                                       </widget>
+                                                      <packing>
+                                                        <property name="expand">True</property>
+                                                        <property name="fill">True</property>
+                                                        <property name="position">5</property>
+                                                      </packing>
                                                     </child>
                                                   </widget>
                                                   <packing>
                                                     <property name="expand">False</property>
                                                     <property name="fill">False</property>
-                                                    <property name="position">7</property>
+                                                    <property name="position">3</property>
                                                   </packing>
                                                 </child>
                                               </widget>
@@ -18996,6 +19049,146 @@ Concentric</property>
                                                     <property name="type">tab</property>
                                                   </packing>
                                                 </child>
+                                                <child>
+                                                  <widget class="GtkVBox" id="vbox_jumps_evolution">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="spacing">2</property>
+                                                    <child>
+                                                      <widget class="GtkHBox" id="hbox301">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="spacing">12</property>
+                                                        <child>
+                                                          <widget class="GtkLabel" id="label417">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Jump 
type</property>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkHBox" 
id="hbox_combo_select_jumps_evolution">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                          </packing>
+                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">False</property>
+                                                        <property name="position">0</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkHBox" id="hbox321">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="spacing">4</property>
+                                                        <child>
+                                                          <widget class="GtkDrawingArea" 
id="drawingarea_jumps_evolution">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <signal name="expose_event" 
handler="on_drawingarea_jumps_evolution_expose_event" swapped="no"/>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkVBox" id="vbox163">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_jumps_evolution_save_image">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <property name="tooltip" translatable="yes">Save 
image</property>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox164">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_jumps_evolution_save">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_forcesensor_analyze_image_save4">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                          </packing>
+                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">True</property>
+                                                        <property name="fill">True</property>
+                                                        <property name="position">1</property>
+                                                      </packing>
+                                                    </child>
+                                                  </widget>
+                                                  <packing>
+                                                    <property name="position">4</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <widget class="GtkLabel" id="label416">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="label">jumps evolution</property>
+                                                  </widget>
+                                                  <packing>
+                                                    <property name="position">4</property>
+                                                    <property name="tab_fill">False</property>
+                                                    <property name="type">tab</property>
+                                                  </packing>
+                                                </child>
                                                 <child>
                                                   <widget class="GtkAlignment" id="alignment_sprint">
                                                     <property name="visible">True</property>
@@ -19188,7 +19381,7 @@ Concentric</property>
                                                     </child>
                                                   </widget>
                                                   <packing>
-                                                    <property name="position">4</property>
+                                                    <property name="position">5</property>
                                                   </packing>
                                                 </child>
                                                 <child>
@@ -19198,7 +19391,7 @@ Concentric</property>
                                                     <property name="label">Sprint</property>
                                                   </widget>
                                                   <packing>
-                                                    <property name="position">4</property>
+                                                    <property name="position">5</property>
                                                     <property name="tab_fill">False</property>
                                                     <property name="type">tab</property>
                                                   </packing>
@@ -22565,6 +22758,15 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -22911,7 +23113,7 @@ Concentric</property>
                                                     </child>
                                                   </widget>
                                                   <packing>
-                                                    <property name="position">5</property>
+                                                    <property name="position">6</property>
                                                   </packing>
                                                 </child>
                                                 <child>
@@ -22921,7 +23123,7 @@ Concentric</property>
                                                     <property name="label">force sensor</property>
                                                   </widget>
                                                   <packing>
-                                                    <property name="position">5</property>
+                                                    <property name="position">6</property>
                                                     <property name="tab_fill">False</property>
                                                     <property name="type">tab</property>
                                                   </packing>
@@ -22971,7 +23173,7 @@ Concentric</property>
                                                     </child>
                                                   </widget>
                                                   <packing>
-                                                    <property name="position">6</property>
+                                                    <property name="position">7</property>
                                                   </packing>
                                                 </child>
                                                 <child>
@@ -22981,7 +23183,7 @@ Concentric</property>
                                                     <property name="label">raceencoder</property>
                                                   </widget>
                                                   <packing>
-                                                    <property name="position">6</property>
+                                                    <property name="position">7</property>
                                                     <property name="tab_fill">False</property>
                                                     <property name="type">tab</property>
                                                   </packing>
@@ -24812,6 +25014,18 @@ Concentric</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_capturing">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
@@ -24848,18 +25062,6 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_no_capturing">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -32089,6 +32291,15 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/Makefile.am b/src/Makefile.am
index 1d25a2c2..1c925308 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -9,6 +9,7 @@ SOURCES = \
        gui/app1/icons.cs\
        gui/app1/jumpsProfile.cs\
        gui/app1/jumpsDjOptimalFall.cs\
+       gui/app1/jumpsEvolution.cs\
        gui/app1/jumpsWeightFVProfile.cs\
        gui/app1/contactsExercise.cs\
        gui/app1/forceSensor.cs\
@@ -18,6 +19,7 @@ SOURCES = \
        gui/app1/run.cs\
        gui/cairo/xy.cs\
        gui/cairo/jumpsDjOptimalFall.cs\
+       gui/cairo/jumpsEvolution.cs\
        gui/cairo/jumpsProfile.cs\
        gui/cairo/jumpsWeightFVProfile.cs\
        gui/chronojumpImporter.cs\
@@ -184,6 +186,7 @@ SOURCES = \
        jump.cs\
        jumpsProfile.cs\
        jumpsDjOptimalFall.cs\
+       jumpsEvolution.cs\
        jumpsWeightFVProfile.cs\
        jumpType.cs\
        networks.cs\
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 6414ac8a..b01b065c 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -93,6 +93,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.RadioButton radio_mode_contacts_jumps_profile;
        [Widget] Gtk.RadioButton radio_mode_contacts_jumps_dj_optimal_fall;
        [Widget] Gtk.RadioButton radio_mode_contacts_jumps_weight_fv_profile;
+       [Widget] Gtk.RadioButton radio_mode_contacts_jumps_evolution;
        [Widget] Gtk.RadioButton radio_mode_contacts_jumps_advanced;
        [Widget] Gtk.RadioButton radio_mode_contacts_sprint;
 
@@ -475,7 +476,7 @@ public partial class ChronoJumpWindow
        
        private string progVersion;
        private string progName;
-       private enum notebook_analyze_pages { STATISTICS, JUMPSPROFILE, JUMPSDJOPTIMALFALL, 
JUMPSWEIGHTFVPROFILE, SPRINT, FORCESENSOR, RACEENCODER }
+       private enum notebook_analyze_pages { STATISTICS, JUMPSPROFILE, JUMPSDJOPTIMALFALL, 
JUMPSWEIGHTFVPROFILE, JUMPSEVOLUTION, SPRINT, FORCESENSOR, RACEENCODER }
 
        private string runningFileName; //useful for knowing if there are two chronojump instances
 
@@ -594,6 +595,7 @@ public partial class ChronoJumpWindow
                createComboSelectJumps(true);
                createComboSelectJumpsDjOptimalFall(true);
                createComboSelectJumpsWeightFVProfile(true);
+               createComboSelectJumpsEvolution(true);
                createComboSelectJumpsRj(true);
                createComboSelectRuns(true);
                createComboSelectRunsInterval(true);
@@ -1087,6 +1089,8 @@ public partial class ChronoJumpWindow
                                jumpsDjOptimalFallDo(true); //calculate data
                        else if(notebook_analyze.CurrentPage == 
Convert.ToInt32(notebook_analyze_pages.JUMPSWEIGHTFVPROFILE))
                                jumpsWeightFVProfileDo(true); //calculate data
+                       else if(notebook_analyze.CurrentPage == 
Convert.ToInt32(notebook_analyze_pages.JUMPSEVOLUTION))
+                               jumpsEvolutionDo(true); //calculate data
                }
                else if(current_menuitem_mode == Constants.Menuitem_modes.JUMPSREACTIVE)
                {
@@ -3110,6 +3114,7 @@ public partial class ChronoJumpWindow
                radio_mode_contacts_jumps_profile.Visible = false;
                radio_mode_contacts_jumps_dj_optimal_fall.Visible = false;
                radio_mode_contacts_jumps_weight_fv_profile.Visible = false;
+               radio_mode_contacts_jumps_evolution.Visible = false;
                radio_mode_contacts_jumps_advanced.Visible = false;
                radio_mode_contacts_sprint.Visible = false;
                notebook_analyze.CurrentPage = Convert.ToInt32(notebook_analyze_pages.STATISTICS);
@@ -3156,6 +3161,7 @@ public partial class ChronoJumpWindow
                                        radio_mode_contacts_jumps_profile.Visible = true;
                                        radio_mode_contacts_jumps_dj_optimal_fall.Visible = true;
                                        radio_mode_contacts_jumps_weight_fv_profile.Visible = true;
+                                       radio_mode_contacts_jumps_evolution.Visible = true;
                                        radio_mode_contacts_jumps_advanced.Visible = true;
                                }
                        } else {
@@ -3168,7 +3174,9 @@ public partial class ChronoJumpWindow
                                radio_mode_contacts_jumps_profile.Hide();
                                radio_mode_contacts_jumps_dj_optimal_fall.Hide();
                                radio_mode_contacts_jumps_weight_fv_profile.Hide();
-                               if(radio_mode_contacts_jumps_profile.Active || 
radio_mode_contacts_jumps_dj_optimal_fall.Active || radio_mode_contacts_jumps_weight_fv_profile.Active)
+                               radio_mode_contacts_jumps_evolution.Hide();
+                               if(radio_mode_contacts_jumps_profile.Active || 
radio_mode_contacts_jumps_dj_optimal_fall.Active ||
+                                               radio_mode_contacts_jumps_weight_fv_profile.Active || 
radio_mode_contacts_jumps_evolution.Active)
                                        radio_mode_contacts_capture.Active = true;
                        }
                }
@@ -3208,6 +3216,7 @@ public partial class ChronoJumpWindow
                        radio_mode_contacts_jumps_profile.Hide();
                        radio_mode_contacts_jumps_dj_optimal_fall.Hide();
                        radio_mode_contacts_jumps_weight_fv_profile.Hide();
+                       radio_mode_contacts_jumps_evolution.Hide();
                        if(radio_mode_contacts_sprint.Active)
                                radio_mode_contacts_capture.Active = true;
                }
@@ -6252,6 +6261,7 @@ LogB.Debug("mc finished 5");
                        createComboSelectJumps(false);
                        createComboSelectJumpsDjOptimalFall(false);
                        createComboSelectJumpsWeightFVProfile(false);
+                       createComboSelectJumpsEvolution(false);
 
                        UtilGtk.ComboUpdate(combo_result_jumps, 
                                        SqliteJumpType.SelectJumpTypes(false, Constants.AllJumpsNameStr(), 
"", true), ""); //without filter, only select name
@@ -7049,6 +7059,7 @@ LogB.Debug("mc finished 5");
                radio_mode_contacts_jumps_profile.Visible = false;
                radio_mode_contacts_jumps_dj_optimal_fall.Visible = false;
                radio_mode_contacts_jumps_weight_fv_profile.Visible = false;
+               radio_mode_contacts_jumps_evolution.Visible = false;
                radio_mode_contacts_jumps_advanced.Visible = false;
                radio_mode_contacts_sprint.Visible = false;
 
@@ -7087,6 +7098,13 @@ LogB.Debug("mc finished 5");
                                        notebook_analyze.CurrentPage = 
Convert.ToInt32(notebook_analyze_pages.JUMPSWEIGHTFVPROFILE);
                                        jumpsWeightFVProfileDo(true);
                                }
+
+                               radio_mode_contacts_jumps_evolution.Visible = true;
+                               if(radio_mode_contacts_jumps_evolution.Active)
+                               {
+                                       notebook_analyze.CurrentPage = 
Convert.ToInt32(notebook_analyze_pages.JUMPSEVOLUTION);
+                                       jumpsEvolutionDo(true);
+                               }
                        }
                        else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSINTERVALLIC)
                        {
@@ -7128,6 +7146,14 @@ LogB.Debug("mc finished 5");
                        jumpsWeightFVProfileDo(true);
                }
        }
+       private void on_radio_mode_contacts_jumps_evolution_toggled (object o, EventArgs args)
+       {
+               if(radio_mode_contacts_jumps_evolution.Active)
+               {
+                       notebook_analyze.CurrentPage = Convert.ToInt32(notebook_analyze_pages.JUMPSEVOLUTION);
+                       jumpsEvolutionDo(true);
+               }
+       }
        private void on_radio_mode_contacts_jumps_advanced_toggled (object o, EventArgs args)
        {
                if(radio_mode_contacts_jumps_advanced.Active)
@@ -7317,6 +7343,7 @@ LogB.Debug("mc finished 5");
                        radio_mode_contacts_jumps_profile.Hide();
                        radio_mode_contacts_jumps_dj_optimal_fall.Hide();
                        radio_mode_contacts_jumps_weight_fv_profile.Hide();
+                       radio_mode_contacts_jumps_evolution.Hide();
                }
                else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSINTERVALLIC)
                {
@@ -7559,6 +7586,7 @@ LogB.Debug("mc finished 5");
                        radio_mode_contacts_jumps_profile.Visible = ! start;
                        radio_mode_contacts_jumps_dj_optimal_fall.Visible = ! start;
                        radio_mode_contacts_jumps_weight_fv_profile.Visible = ! start;
+                       radio_mode_contacts_jumps_evolution.Visible = ! start;
                } else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSINTERVALLIC)
                        radio_mode_contacts_sprint.Visible = ! start;
 
diff --git a/src/gui/app1/icons.cs b/src/gui/app1/icons.cs
index 12b44fc9..6777c389 100644
--- a/src/gui/app1/icons.cs
+++ b/src/gui/app1/icons.cs
@@ -732,6 +732,7 @@ public partial class ChronoJumpWindow
                image_encoder_analyze_individual_current_session.Pixbuf = pixbuf;
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + 
Constants.FileNameEncoderAnalyzeIndividualAllSessionsIcon);
                image_encoder_analyze_individual_all_sessions.Pixbuf = pixbuf;
+               image_tab_jumps_evolution.Pixbuf = pixbuf;
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + 
Constants.FileNameEncoderAnalyzeGroupalCurrentSessionIcon);
                image_encoder_analyze_groupal_current_session.Pixbuf = pixbuf;
 
diff --git a/src/gui/app1/jumpsDjOptimalFall.cs b/src/gui/app1/jumpsDjOptimalFall.cs
index cb07aeb4..581f21de 100644
--- a/src/gui/app1/jumpsDjOptimalFall.cs
+++ b/src/gui/app1/jumpsDjOptimalFall.cs
@@ -62,7 +62,8 @@ public partial class ChronoJumpWindow
 
        private void jumpsDjOptimalFallDo (bool calculateData)
        {
-               if(currentPerson == null || currentSession == null)
+               if(currentPerson == null || currentSession == null ||
+                               drawingarea_jumps_dj_optimal_fall == null || 
drawingarea_jumps_dj_optimal_fall.GdkWindow == null) //it happens at start on click on analyze
                {
                        button_jumps_dj_optimal_fall_save_image.Sensitive = false;
                        return;
diff --git a/src/gui/app1/jumpsEvolution.cs b/src/gui/app1/jumpsEvolution.cs
new file mode 100644
index 00000000..c707d420
--- /dev/null
+++ b/src/gui/app1/jumpsEvolution.cs
@@ -0,0 +1,140 @@
+/*
+ * This file is part of ChronoJump
+ *
+ * Chronojump is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or   
+ *    (at your option) any later version.
+ *    
+ * Chronojump is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
+ *    GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Copyright (C) 2004-2019   Xavier de Blas <xaviblas gmail com> 
+ */
+
+
+using System;
+using Gtk;
+using Glade;
+using Mono.Unix;
+
+public partial class ChronoJumpWindow 
+{
+       [Widget] Gtk.DrawingArea drawingarea_jumps_evolution;
+       [Widget] Gtk.Image image_tab_jumps_evolution;
+       [Widget] Gtk.Image image_jumps_evolution_save;
+       [Widget] Gtk.HBox hbox_combo_select_jumps_evolution;
+       [Widget] Gtk.ComboBox combo_select_jumps_evolution;
+       [Widget] Gtk.Button button_jumps_evolution_save_image;
+
+       JumpsEvolution jumpsEvolution;
+       CjComboSelectJumps comboSelectJumpsEvolution;
+
+       // combo (start)
+       private void createComboSelectJumpsEvolution(bool create)
+       {
+               if(create)
+               {
+                       comboSelectJumpsEvolution = new CjComboSelectJumps(combo_select_jumps_evolution, 
hbox_combo_select_jumps_evolution, false);
+                       combo_select_jumps_evolution = comboSelectJumpsEvolution.Combo;
+                       combo_select_jumps_evolution.Changed += new EventHandler 
(on_combo_select_jumps_evolution_changed);
+               } else {
+                       comboSelectJumpsEvolution.Fill();
+                       combo_select_jumps_evolution = comboSelectJumpsEvolution.Combo;
+               }
+               combo_select_jumps_evolution.Sensitive = true;
+       }
+       private void on_combo_select_jumps_evolution_changed(object o, EventArgs args)
+       {
+               ComboBox combo = o as ComboBox;
+               if (o == null)
+                       return;
+
+               jumpsEvolutionDo(true);
+       }
+       // combo (end)
+
+       private void jumpsEvolutionDo (bool calculateData)
+       {
+               if(currentPerson == null || currentSession == null ||
+                               drawingarea_jumps_evolution == null || drawingarea_jumps_evolution.GdkWindow 
== null) //it happens at start on click on analyze
+               {
+                       button_jumps_evolution_save_image.Sensitive = false;
+                       return;
+               }
+
+               if(jumpsEvolution == null) {
+                       jumpsEvolution = new JumpsEvolution();
+                       calculateData = true;
+               }
+
+               string jumpType = UtilGtk.ComboGetActive(combo_select_jumps_evolution);
+
+               if(calculateData)
+                       jumpsEvolution.Calculate(currentPerson.UniqueID, jumpType);
+
+               if(jumpsEvolution.Point_l.Count == 0)
+               {
+                       //constructor for showing blank screen with a message
+                       new JumpsEvolutionGraph(drawingarea_jumps_evolution, jumpType);
+                                       //currentPerson.Name, jumpType, currentSession.DateShort);
+
+                       button_jumps_evolution_save_image.Sensitive = false;
+
+               } else {
+                       //regular constructor
+                       JumpsEvolutionGraph jeg = new JumpsEvolutionGraph(
+                                       jumpsEvolution.Point_l,
+                                       jumpsEvolution.Coefs,
+                                       jumpsEvolution.ParaboleType, //model
+                                       jumpsEvolution.XatMaxY, //model
+                                       jumpsEvolution.GetMaxValue(),
+                                       drawingarea_jumps_evolution,
+                                       currentPerson.Name, jumpType, currentSession.DateShort);
+                       jeg.Do();
+
+                       button_jumps_evolution_save_image.Sensitive = true;
+               }
+       }
+       private void on_drawingarea_jumps_evolution_expose_event (object o, ExposeEventArgs args) 
+       {
+               jumpsEvolutionDo(false); //do not calculate data
+               //data is calculated on switch page (at notebook_capture_analyze) or on change person
+       }
+
+       //TODO
+       private void on_button_jumps_evolution_save_image_clicked (object o, EventArgs args)
+       {
+               //checkFile(Constants.CheckFileOp.JUMPS_EVOLUTION_SAVE_IMAGE);
+       }
+
+       /*
+       private void on_button_jumps_evolution_save_image_selected (string destination)
+       {
+               if(drawingarea_jumps_evolution == null)
+                       return;
+
+               Gdk.Pixbuf pixbuf = Gdk.Pixbuf.FromDrawable(drawingarea_jumps_evolution.GdkWindow, 
Gdk.Colormap.System,
+                               0, 0, 0, 0,
+                               UtilGtk.WidgetWidth(drawingarea_jumps_evolution),
+                               UtilGtk.WidgetHeight(drawingarea_jumps_evolution) );
+
+               LogB.Information("Saving");
+               pixbuf.Save(destination,"png");
+       }
+       private void on_overwrite_file_jumps_evolution_save_image_accepted (object o, EventArgs args)
+       {
+               on_button_jumps_evolution_save_image_selected (exportFileName);
+
+               string myString = string.Format(Catalog.GetString("Saved to {0}"), exportFileName);
+               new DialogMessage(Constants.MessageTypes.INFO, myString);
+       }
+       */
+
+}
diff --git a/src/gui/app1/jumpsWeightFVProfile.cs b/src/gui/app1/jumpsWeightFVProfile.cs
index cae7a4b2..9be0b2a0 100644
--- a/src/gui/app1/jumpsWeightFVProfile.cs
+++ b/src/gui/app1/jumpsWeightFVProfile.cs
@@ -68,7 +68,8 @@ public partial class ChronoJumpWindow
        {
                button_jumps_weight_fv_profile_save_image.Sensitive = false;
 
-               if(currentPerson == null || currentPersonSession == null || currentSession == null)
+               if(currentPerson == null || currentPersonSession == null || currentSession == null ||
+                               drawingarea_jumps_weight_fv_profile == null || 
drawingarea_jumps_weight_fv_profile.GdkWindow == null) //it happens at start on click on analyze
                        return;
                
                if(currentPersonSession.TrochanterToe == Constants.TrochanterToeUndefinedID || 
diff --git a/src/gui/cairo/jumpsEvolution.cs b/src/gui/cairo/jumpsEvolution.cs
new file mode 100644
index 00000000..19ab54c3
--- /dev/null
+++ b/src/gui/cairo/jumpsEvolution.cs
@@ -0,0 +1,115 @@
+
+/*
+ * This file is part of ChronoJump
+ *
+ * ChronoJump is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or   
+ *    (at your option) any later version.
+ *    
+ * ChronoJump is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
+ *    GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *  Copyright (C) 2004-2020   Xavier de Blas <xaviblas gmail com> 
+ *  Copyright (C) 2004-2020   Jordi Rodeiro <jordirodeiro gmail com> 
+ */
+
+using System;
+using System.Collections.Generic; //List
+using Gtk;
+using Cairo;
+
+
+public class JumpsEvolutionGraph : CairoXY
+{
+       //constructor when there are no points
+       public JumpsEvolutionGraph (DrawingArea area, string jumpType)//, string title, string jumpType, 
string date)
+       {
+               this.area = area;
+
+               initGraph();
+
+               g.SetFontSize(16);
+               printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight,
+                               string.Format("Need to execute jumps: {0}.", jumpType), g, true);
+
+               endGraph();
+       }
+
+       //regular constructor
+       public JumpsEvolutionGraph (
+                       List<Point> point_l, double[] coefs,
+                       LeastSquares.ParaboleTypes paraboleType,
+                       double xAtMMaxY, //x at Model MaxY
+                       double pointsMaxValue,
+                       DrawingArea area,
+                       string title, string jumpType, string date)
+       {
+               this.point_l = point_l;
+               this.coefs = coefs;
+               this.paraboleType = paraboleType;
+               this.xAtMMaxY = xAtMMaxY;
+               this.pointsMaxValue = pointsMaxValue;
+               this.area = area;
+               this.title = title;
+               this.jumpType = jumpType;
+               this.date = date;
+
+               axisYLabel = "Height (cm)";
+               axisXLabel = "Date (double)";
+       }
+
+       public override void Do()
+       {
+               LogB.Information("at JumpsEvolutionGraph.Do");
+               initGraph();
+
+                findPointMaximums();
+                findAbsoluteMaximums();
+               paintAxisAndGrid();
+
+               LogB.Information(string.Format("coef length:{0}", coefs.Length));
+               if(coefs.Length == 3)
+                       plotPredictedLine();
+
+               plotRealPoints();
+
+               if(coefs.Length == 3)
+               {
+                       if(paraboleType == LeastSquares.ParaboleTypes.CONVEX)
+                       {
+                               plotPredictedMaxPoint();
+                               writeTextPredictedPoint();
+                       }
+                       else
+                               writeTextConcaveParabole();
+               } else {
+                       writeTextNeed3PointsWithDifferentFall();
+               }
+               writeTitle();
+
+               endGraph();
+       }
+
+       //here X is year, add half a year
+       protected override void separateMinXMaxX()
+       {
+               minX -= .5;
+               maxX += .5;
+       }
+
+       protected override void writeTitle()
+       {
+               writeTextAtRight(-5, title, true);
+               //writeTextAtRight(-4, "Optimal fall height", false);
+               writeTextAtRight(-3, "Jumptype: " + jumpType, false);
+               writeTextAtRight(-2, date, false);
+       }
+
+}
diff --git a/src/gui/cairo/xy.cs b/src/gui/cairo/xy.cs
index a996aad0..8f09a153 100644
--- a/src/gui/cairo/xy.cs
+++ b/src/gui/cairo/xy.cs
@@ -42,10 +42,10 @@ public abstract class CairoXY
        protected string axisYLabel = "";
        protected string axisXLabel = "";
 
-       double minX = 1000000;
-       double maxX = 0;
-       double minY = 1000000;
-       double maxY = 0;
+       protected double minX = 1000000;
+       protected double maxX = 0;
+       protected double minY = 1000000;
+       protected double maxY = 0;
        double yAtMMaxY;
        double absoluteMaxX;
        double absoluteMaxY;
@@ -102,20 +102,25 @@ public abstract class CairoXY
 
                //if there is only one point, or by any reason mins == maxs, have mins and maxs separated
                if(minX == maxX)
-               {
-                       minX -= .5 * minX;
-                       maxX += .5 * maxX;
-               }
+                       separateMinXMaxX();
                if(minY == maxY)
-               {
-                       minY -= .5 * minY;
-                       maxY += .5 * maxY;
-               }
+                       separateMinYMaxY();
 
                absoluteMaxX = maxX;
                absoluteMaxY = maxY;
        }
 
+       protected virtual void separateMinXMaxX()
+       {
+               minX -= .5 * minX;
+               maxX += .5 * maxX;
+       }
+       protected virtual void separateMinYMaxY()
+       {
+               minY -= .5 * minY;
+               maxY += .5 * maxY;
+       }
+
        //includes point  and model
        protected void findAbsoluteMaximums()
        {
@@ -196,7 +201,7 @@ public abstract class CairoXY
        {
                foreach(Point p in point_l)
                {
-                       //LogB.Information(string.Format("point: {0}", p));
+                       LogB.Information(string.Format("point: {0}", p));
                        double xgraph = calculatePaintX(
                                        ( p.X ),
                                        graphWidth, absoluteMaxX, minX, totalMargins, totalMargins);
diff --git a/src/jump.cs b/src/jump.cs
index 4d06a8ff..1dbbc72d 100644
--- a/src/jump.cs
+++ b/src/jump.cs
@@ -91,7 +91,7 @@ public class Jump : Event
        
 
        public override string ToString() {
-               return uniqueID + ":" + personID + ":" + sessionID + ":" + type + ":" + tv + ":" + tc; //...
+               return uniqueID + ":" + personID + ":" + sessionID + ":" + type + ":" + tv + ":" + tc + ":" + 
datetime; //...
        }
 
        public virtual bool TypeHasWeight {
diff --git a/src/jumpsEvolution.cs b/src/jumpsEvolution.cs
new file mode 100644
index 00000000..3a4ffc12
--- /dev/null
+++ b/src/jumpsEvolution.cs
@@ -0,0 +1,112 @@
+/*
+ * This file is part of ChronoJump
+ *
+ * ChronoJump is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or   
+ *    (at your option) any later version.
+ *    
+ * ChronoJump is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
+ *    GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *  Copyright (C) 2019   Xavier de Blas <xaviblas gmail com>, Jordi Rodeiro <jordirodeiro gmail com>
+ */
+
+using System;
+using System.Collections.Generic; //List
+
+//TODO: very similar to JumpsDjOptimalFall, refactorize if needed
+
+public class JumpsEvolution
+{
+       private List<Point> point_l;
+       LeastSquares ls;
+
+       //constructor
+       public JumpsEvolution()
+       {
+       }
+       
+       public void Calculate (int personID, string jumpType)
+       {
+               //1 get data
+                List<Jump> jump_l = SqliteJump.SelectJumps (personID, -1, jumpType);
+
+               //2 convert to list of Point
+               //List<Point> point_l = new List<Point>();
+               point_l = new List<Point>();
+                foreach(Jump j in jump_l)
+               {
+                       DateTime dt = UtilDate.FromFile(j.Datetime);
+                       double dtDouble = UtilDate.DateTimeYearDayAsDouble(dt);
+
+                       point_l.Add(new Point(
+                                               dtDouble,
+                                               Util.GetHeightInCentimeters(j.Tv)
+                                               ));
+               }
+
+               //3 get LeastSquares
+               ls = new LeastSquares();
+               ls.Calculate(point_l);
+
+               //4 print data
+               if(ls.CalculatedCoef)
+                       LogB.Information(string.Format("coef = {0} {1} {2}",
+                                               ls.Coef[0], ls.Coef[1], ls.Coef[2]));
+
+               if(ls.CalculatedXatMaxY)
+                       LogB.Information(string.Format("XatMaxY = {0}", ls.XatMaxY));
+       }
+
+       public double GetMaxValue()
+       {
+               double maxValue = 0;
+                foreach(Point p in point_l)
+               {
+                       if(p.X > maxValue)
+                               maxValue = p.X;
+                       if(p.Y > maxValue)
+                               maxValue = p.Y;
+               }
+
+               return maxValue;
+       }
+
+       public List<Point> Point_l
+       {
+               get { return point_l; }
+       }
+
+       public double[] Coefs
+       {
+               get {
+                       if(! ls.CalculatedCoef)
+                               return new double[0];
+
+                       LogB.Information(string.Format("coef0:{0}", ls.Coef[0]));
+                       return ls.Coef;
+               }
+       }
+
+       public LeastSquares.ParaboleTypes ParaboleType
+       {
+               get { return ls.ParaboleType; }
+       }
+
+       public double XatMaxY //model
+       {
+               get {
+                       if(! ls.CalculatedXatMaxY)
+                               return -1;
+
+                       return ls.XatMaxY;
+               }
+       }
+}
diff --git a/src/sqlite/jump.cs b/src/sqlite/jump.cs
index 83311b3e..d0963c97 100644
--- a/src/sqlite/jump.cs
+++ b/src/sqlite/jump.cs
@@ -96,6 +96,7 @@ class SqliteJump : Sqlite
                return myLast;
        }
 
+       //like SelectJumps, but this returns a string[] :( better use above method if possible
        //if all sessions, put -1 in sessionID
        //if all persons, put -1 in personID
        //if all types put, "" in filterType
@@ -191,6 +192,39 @@ class SqliteJump : Sqlite
                return myJumps;
        }
 
+       //like SelectJumps above method but much better: return list of jumps
+       //sID -1 means all sessions
+       public static List<Jump> SelectJumps (int pID, int sID, string jumpType)
+       {
+         //jumps previous to DB 1.82 have no datetime on jump
+         //find session datetime for that jumps
+         List<Session> session_l = SqliteSession.SelectAll();
+
+         string personID = pID.ToString();
+         string filterSessionString = "";
+         if(sID != -1)
+                 filterSessionString = " AND sessionID == " + sID.ToString();
+
+         Sqlite.Open();
+
+         // Selecciona les dades de tots els salts
+         dbcmd.CommandText = "SELECT * FROM jump WHERE personID = " + personID +
+                 filterSessionString +  " AND jump.type = \"" + jumpType + "\"";
+
+         LogB.SQL(dbcmd.CommandText.ToString());
+         dbcmd.ExecuteNonQuery();
+
+         SqliteDataReader reader;
+         reader = dbcmd.ExecuteReader();
+
+         List<Jump> jmp_l = DataReaderToJump (reader, session_l);
+
+         reader.Close();
+         Sqlite.Close();
+
+         return jmp_l;
+       }
+
        public static Jump SelectJumpData(int uniqueID, bool dbconOpened)
        {
                if(!dbconOpened)
@@ -304,7 +338,7 @@ class SqliteJump : Sqlite
                return l;
        }
 
-       private static List<Jump> DataReaderToJump (SqliteDataReader reader)
+       private static List<Jump> DataReaderToJump (SqliteDataReader reader, List<Session> session_l)
        {
          List<Jump> jmp_l = new List<Jump>();
          Jump jmp;
@@ -331,6 +365,13 @@ class SqliteJump : Sqlite
                                  reader[11].ToString()                               //datetime
                                 );
 
+                 //jumps previous to DB 1.82 have no datetime on jump
+                 //find session datetime for that jumps
+                 if(jmp.Datetime == "")
+                         foreach(Session session in session_l)
+                                 if(session.UniqueID == jmp.SessionID)
+                                         jmp.Datetime = UtilDate.ToFile(session.Date);
+
                  jmp_l.Add(jmp);
                  LogB.Information(jmp.ToString());
          }
@@ -340,6 +381,10 @@ class SqliteJump : Sqlite
        //last boolean: on JumpsDj analyze graph, only show the higher of values of the same fall
        public static List<Jump> SelectDJ (int pID, int sID, string jumpType, bool onlyHigherOfSameFall)
        {
+         //jumps previous to DB 1.82 have no datetime on jump
+         //find session datetime for that jumps
+         List<Session> session_l = SqliteSession.SelectAll();
+
          string personID = pID.ToString();
          string sessionID = sID.ToString();
 
@@ -358,7 +403,7 @@ class SqliteJump : Sqlite
          SqliteDataReader reader;
          reader = dbcmd.ExecuteReader();
 
-         List<Jump> jmp_l = DataReaderToJump (reader);
+         List<Jump> jmp_l = DataReaderToJump (reader, session_l);
 
          reader.Close();
          Sqlite.Close();
@@ -384,6 +429,10 @@ class SqliteJump : Sqlite
        //TODO: note we do not want % weight, we want absolute weight so we need to select on personSession77 
table
        public static List<Jump> SelectJumpsWeightFVProfile (int pID, int sID, bool onlyHigherOfSameWeight)
        {
+         //jumps previous to DB 1.82 have no datetime on jump
+         //find session datetime for that jumps
+         List<Session> session_l = SqliteSession.SelectAll();
+
          string personID = pID.ToString();
          string sessionID = sID.ToString();
 
@@ -402,7 +451,7 @@ class SqliteJump : Sqlite
          SqliteDataReader reader;
          reader = dbcmd.ExecuteReader();
 
-         List<Jump> jmp_l = DataReaderToJump (reader);
+         List<Jump> jmp_l = DataReaderToJump (reader, session_l);
 
          reader.Close();
          Sqlite.Close();
diff --git a/src/sqlite/session.cs b/src/sqlite/session.cs
index 44021ff1..70de38c6 100644
--- a/src/sqlite/session.cs
+++ b/src/sqlite/session.cs
@@ -222,21 +222,39 @@ class SqliteSession : Sqlite
                        Sqlite.Close();
        }
 
+       // ---- use this methods ----
 
        //by name (only in gui/networks.cs configInit
        //be careful because name is not unique
        public static Session SelectByName(string name)
        {
-               dbcmd.CommandText = "SELECT * FROM " + Constants.SessionTable + " WHERE name == \"" + name + 
"\""; 
-               return SelectDo(dbcmd);
+               dbcmd.CommandText = "SELECT * FROM " + Constants.SessionTable + " WHERE name == \"" + name + 
"\"";
+
+               List<Session> session_l = selectDo(dbcmd);
+               if(session_l.Count == 0)
+                       return new Session();
+
+               //return (Session) selectDo(dbcmd)[0];
+               return session_l[0];
        }
        //by ID (default
        public static Session Select(string myUniqueID)
        {
                dbcmd.CommandText = "SELECT * FROM " + Constants.SessionTable + " WHERE uniqueID == " + 
myUniqueID ; 
-               return SelectDo(dbcmd);
+
+               List<Session> session_l = selectDo(dbcmd);
+               if(session_l.Count == 0)
+                       return new Session();
+
+               //return (Session) selectDo(dbcmd)[0];
+               return session_l[0];
+       }
+       public static List<Session> SelectAll()
+       {
+               dbcmd.CommandText = "SELECT * FROM " + Constants.SessionTable;
+               return selectDo(dbcmd);
        }
-       public static Session SelectDo(SqliteCommand mydbcmd)
+       private static List<Session> selectDo(SqliteCommand mydbcmd)
        {
                try {
                        Sqlite.Open();
@@ -251,29 +269,28 @@ class SqliteSession : Sqlite
                
                SqliteDataReader reader;
                reader = mydbcmd.ExecuteReader();
+               List<Session> session_l = new List<Session>();
        
-               string [] values = new string[9];
-               
-               while(reader.Read()) {
-                       values[0] = reader[0].ToString(); 
-                       values[1] = reader[1].ToString(); 
-                       values[2] = reader[2].ToString();
-                       values[3] = reader[3].ToString();
-                       values[4] = reader[4].ToString();
-                       values[5] = reader[5].ToString();
-                       values[6] = reader[6].ToString();
-                       values[7] = reader[7].ToString();
-                       values[8] = reader[8].ToString();
+               while(reader.Read())
+               {
+                       Session session = new Session(
+                                       reader[0].ToString(),
+                                       reader[1].ToString(),
+                                       reader[2].ToString(),
+                                       UtilDate.FromSql(reader[3].ToString()),
+                                       Convert.ToInt32(reader[4].ToString()),
+                                       Convert.ToInt32(reader[5].ToString()),
+                                       Convert.ToInt32(reader[6].ToString()),
+                                       reader[7].ToString(),
+                                       Convert.ToInt32(reader[8].ToString())
+                                       );
+
+                       session_l.Add(session);
                }
 
-               Session mySession = new Session(values[0], 
-                       values[1], values[2], UtilDate.FromSql(values[3]), 
-                       Convert.ToInt32(values[4]), Convert.ToInt32(values[5]), Convert.ToInt32(values[6]), 
-                       values[7], Convert.ToInt32(values[8]) );
-               
                reader.Close();
                Sqlite.Close();
-               return mySession;
+               return session_l;
        }
        
        //used by the stats selector of sessions
diff --git a/src/utilDate.cs b/src/utilDate.cs
index a20b346f..6c815afd 100644
--- a/src/utilDate.cs
+++ b/src/utilDate.cs
@@ -48,6 +48,23 @@ public class UtilDate
                        UtilAll.DigitsCreate(dt.Second,2);
        }
 
+       //records date & time, useful to backup database without having strange chars on filename
+       //used also on SQL when time wants to be stored also
+       public static DateTime FromFile (string s)
+       {
+               //TODO: check possible errors
+               string [] allFull = s.Split(new char[] {'_'});
+               string [] dateFull = allFull[0].Split(new char[] {'-'});
+               string [] timeFull = allFull[1].Split(new char[] {'-'});
+               return new DateTime(
+                               Convert.ToInt32(dateFull[0]),
+                               Convert.ToInt32(dateFull[1]),
+                               Convert.ToInt32(dateFull[2]),
+                               Convert.ToInt32(timeFull[0]),
+                               Convert.ToInt32(timeFull[1]),
+                               Convert.ToInt32(timeFull[2])
+                               );
+       }
 
        //comes from sql like YYYY-MM-DD (with always all digits)
        //return datetime



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]