It is currently Tue Mar 09, 2021 9:34 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 91 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next
Author Message
 Post subject: Re: [Module] Chart - Gadget
PostPosted: Thu Mar 05, 2020 11:48 am 
Offline
User
User

Joined: Sun Feb 23, 2020 4:28 pm
Posts: 15
Thanks Thorsten1867

Your help is appreciated ;)


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Chart - Gadget
PostPosted: Sat Mar 07, 2020 11:14 am 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 1265
Location: Germany
I took a look at the code and actually it should already work.
Have you ever tried this:

Code:
Chart::SetAttribute(#Chart, Chart::#Decimals, 2)

_________________
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Chart - Gadget
PostPosted: Sat Mar 07, 2020 1:00 pm 
Offline
User
User

Joined: Sun Feb 23, 2020 4:28 pm
Posts: 15
Yes, i used it in my ChartCreate code posted previously.

but I still get rounded value for the YAxis in my charts.

I'm using this test code, and the value are rounded too
Code:
XIncludeFile "ChartModule.pbi"

Enumeration
  #Window
  #Chart
EndEnumeration

If OpenWindow(#Window, #PB_Ignore, #PB_Ignore, 400, 200, "Chart decimal test", #PB_Window_ScreenCentered)
        Chart::Gadget(#Chart, 10, 10, 295, 180, Chart::#ScatterPlot|Chart::#Border|Chart::#ToolTips|Chart::#AutoResize|Chart::#ShowLines, #Window)
        Chart::SetAttribute(#Chart, Chart::#MaximumY, 50)
        Chart::SetAttribute(#Chart, Chart::#MinimumY, 40)
        Chart::SetAttribute(#Chart, Chart::#MinimumX, Date(2019, 1, 1, 8, 0, 0))
        Chart::SetAttribute(#Chart, Chart::#MaximumX, Date(2019, 1, 1, 13, 0, 0))
       
        Chart::AddAxisLabel(#Chart,  "8:00", Date(2019, 1, 1,  8, 0, 0))
        Chart::AddAxisLabel(#Chart,  "9:00", Date(2019, 1, 1,  9, 0, 0))
        Chart::AddAxisLabel(#Chart, "10:00", Date(2019, 1, 1, 10, 0, 0))
        Chart::AddAxisLabel(#Chart, "11:00", Date(2019, 1, 1, 11, 0, 0))
        Chart::AddAxisLabel(#Chart, "12:00", Date(2019, 1, 1, 12, 0, 0))
        Chart::AddAxisLabel(#Chart, "13:00", Date(2019, 1, 1, 13, 0, 0))
        Chart::SetFlags(#Chart, Chart::#AxisX, Chart::#Time|Chart::#Labels)

        Chart::SetAttribute(#Chart, Chart::#Decimals, 2)
        Chart::ToolTipText(#Chart, Chart::#Scatter$ + ": " + Chart::#Value$)
       
       
        If Chart::AddScatterPlot(#Chart, "Scatter 1", $FF901E)
          Chart::AddScatterItem(#Chart, "Scatter 1", "08:30",  Date(2019, 1, 1,  8, 30, 0), 45.33)
          Chart::AddScatterItem(#Chart, "Scatter 1", "10:30",  Date(2019, 1, 1,  10, 30, 0), 46.55)
          Chart::AddScatterItem(#Chart, "Scatter 1", "11::30", Date(2019, 1, 1,  11, 30, 0), 46.27)
          Chart::AddScatterItem(#Chart, "Scatter 1", "12::30", Date(2019, 1, 1,  12, 30, 0), 46.77)
        EndIf
        Chart::DisplayScatterPlot(#Chart, "Scatter 1", #True)
       
        Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf


The tooltip show rounded value too. And the chart seems to be using rounded value too.

Am I doing something wrong ?


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Chart - Gadget
PostPosted: Sat Mar 07, 2020 1:32 pm 
Offline
User
User

Joined: Sun Feb 23, 2020 4:28 pm
Posts: 15
I've updated my test code to show the rounding more clearly ;)


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Chart - Gadget
PostPosted: Sat Mar 07, 2020 1:38 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 1265
Location: Germany
Code:
Chart::SetAttribute(#Chart, Chart::#MaximumY, 48.5)

_________________
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Chart - Gadget
PostPosted: Sat Mar 07, 2020 2:04 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 1265
Location: Germany
Bugfixes

_________________
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Chart - Gadget
PostPosted: Sat Mar 07, 2020 3:08 pm 
Offline
User
User

Joined: Sun Feb 23, 2020 4:28 pm
Posts: 15
Code:
XIncludeFile "ChartModule.pbi"

Enumeration
  #Window
  #Chart
EndEnumeration

If OpenWindow(#Window, #PB_Ignore, #PB_Ignore, 400, 200, "Chart decimal test", #PB_Window_ScreenCentered)
        Chart::Gadget(#Chart, 10, 10, 295, 180, Chart::#ScatterPlot|Chart::#Border|Chart::#ToolTips|Chart::#AutoResize|Chart::#ShowLines, #Window)
        Chart::SetAttribute(#Chart, Chart::#MaximumY, 47)
        Chart::SetAttribute(#Chart, Chart::#MinimumY, 45)
        Chart::SetAttribute(#Chart, Chart::#MinimumX, Date(2019, 1, 1, 8, 0, 0))
        Chart::SetAttribute(#Chart, Chart::#MaximumX, Date(2019, 1, 1, 13, 0, 0))
       
        Chart::AddAxisLabel(#Chart,  "8:00", Date(2019, 1, 1,  8, 0, 0))
        Chart::AddAxisLabel(#Chart,  "9:00", Date(2019, 1, 1,  9, 0, 0))
        Chart::AddAxisLabel(#Chart, "10:00", Date(2019, 1, 1, 10, 0, 0))
        Chart::AddAxisLabel(#Chart, "11:00", Date(2019, 1, 1, 11, 0, 0))
        Chart::AddAxisLabel(#Chart, "12:00", Date(2019, 1, 1, 12, 0, 0))
        Chart::AddAxisLabel(#Chart, "13:00", Date(2019, 1, 1, 13, 0, 0))
        Chart::SetFlags(#Chart, Chart::#AxisX, Chart::#Time|Chart::#Labels)

        Chart::SetAttribute(#Chart, Chart::#Decimals, 2)
        Chart::ToolTipText(#Chart, Chart::#Scatter$ + ": " + Chart::#Value$)
       
       
        If Chart::AddScatterPlot(#Chart, "Scatter 1", $FF901E)
          Chart::AddScatterItem(#Chart, "Scatter 1", "08:30",  Date(2019, 1, 1,  8, 30, 0), 45.33)
          Chart::AddScatterItem(#Chart, "Scatter 1", "10:30",  Date(2019, 1, 1,  10, 30, 0), 46.55)
          Chart::AddScatterItem(#Chart, "Scatter 1", "11::30", Date(2019, 1, 1,  11, 30, 0), 46.27)
          Chart::AddScatterItem(#Chart, "Scatter 1", "12::30", Date(2019, 1, 1,  12, 30, 0), 46.77)
        EndIf
        Chart::DisplayScatterPlot(#Chart, "Scatter 1", #True)
       
        Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf


Last edited by cyril on Sat Mar 07, 2020 4:08 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Chart - Gadget
PostPosted: Sat Mar 07, 2020 3:17 pm 
Offline
User
User

Joined: Sun Feb 23, 2020 4:28 pm
Posts: 15
Here is an image showing the rounding of value.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Chart - Gadget
PostPosted: Sun Mar 08, 2020 9:58 am 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 1265
Location: Germany
Update: Floats for item data

_________________
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Chart - Gadget
PostPosted: Sun Mar 08, 2020 1:31 pm 
Offline
User
User

Joined: Sun Feb 23, 2020 4:28 pm
Posts: 15
Thanks for the update Thorsten1867.

I finally got it working :)


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Chart - Gadget
PostPosted: Sun Mar 15, 2020 7:39 pm 
Offline
User
User

Joined: Sun Feb 23, 2020 4:28 pm
Posts: 15
Hello Thorsten

I'm having a problem with tooltips using a scatterplot graph.

I'm using:
Code:
Chart::ToolTipText(#Gadget_Chart, Chart::#Scatter$ + ": " + Chart::#Time$ + " - " + Chart::#DataY$ + " pounds")

But the tooltip is still something like: "128.888888888" instead of "Weight: 01/03/2020 - 128.89 pounds".

I also tried with
Code:
Chart::ToolTipText(#Gadget_Chart, Chart::#Scatter$ + ": " + Chart::#Time$ + " - " + Chart::#Value$ + " pounds")


The complete initialization code i'm using is:
Code:
Chart::Gadget(#Gadget_Chart, x, y, width, height, Chart::#ScatterPlot|Chart::#Border|Chart::#ShowLines|Chart::#ToolTips|Chart::#AutoResize, #Window_Main)
Chart::SetFlags(#Gadget_Chart, Chart::#AxisX, Chart::#Time|Chart::#Labels)
Chart::SetAttribute(#Gadget_Chart, Chart::#Decimals, 2)
Chart::SetMask(#Gadget_Chart, Chart::#AxisX, "%dd/%mm/%yyyy")
Chart::ToolTipText(#Gadget_Chart, Chart::#Scatter$ + ": " + Chart::#Time$ + " - " + Chart::#DataY$ + " pounds")


What am I doing wrong ?


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Chart - Gadget
PostPosted: Fri Mar 20, 2020 2:39 pm 
Offline
User
User

Joined: Sun Feb 23, 2020 4:28 pm
Posts: 15
Here is a sample code that shows the problem:

Code:
XIncludeFile "ChartModule.pbi"

Enumeration
  #Window
  #Chart
EndEnumeration

If OpenWindow(#Window, #PB_Ignore, #PB_Ignore, 400, 200, "Chart decimal test", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
        Chart::Gadget(#Chart, 10, 10, 380, 180, Chart::#ScatterPlot|Chart::#Border|Chart::#ToolTips|Chart::#AutoResize|Chart::#ShowLines, #Window)
        Chart::SetAttribute(#Chart, Chart::#MaximumY, 47)
        Chart::SetAttribute(#Chart, Chart::#MinimumY, 45)
        Chart::SetAttribute(#Chart, Chart::#MinimumX, Date(2019, 1, 1, 8, 0, 0))
        Chart::SetAttribute(#Chart, Chart::#MaximumX, Date(2019, 1, 1, 13, 0, 0))
       
        Chart::AddAxisLabel(#Chart,  "8:00", Date(2019, 1, 1,  8, 0, 0))
        Chart::AddAxisLabel(#Chart,  "9:00", Date(2019, 1, 1,  9, 0, 0))
        Chart::AddAxisLabel(#Chart, "10:00", Date(2019, 1, 1, 10, 0, 0))
        Chart::AddAxisLabel(#Chart, "11:00", Date(2019, 1, 1, 11, 0, 0))
        Chart::AddAxisLabel(#Chart, "12:00", Date(2019, 1, 1, 12, 0, 0))
        Chart::AddAxisLabel(#Chart, "13:00", Date(2019, 1, 1, 13, 0, 0))
        Chart::SetFlags(#Chart, Chart::#AxisX, Chart::#Time|Chart::#Labels)

        Chart::SetAttribute(#Chart, Chart::#Decimals, 2)
        Chart::ToolTipText(#Chart, Chart::#Scatter$ + ": " + Chart::#Time$ + " - " + Chart::#Value$ + " pounds")
       
       
        If Chart::AddScatterPlot(#Chart, "Scatter 1", $FF901E)
          Chart::AddScatterItem(#Chart, "Scatter 1", "08:30",  Date(2019, 1, 1,  8, 30, 0), 45.33)
          Chart::AddScatterItem(#Chart, "Scatter 1", "10:30",  Date(2019, 1, 1,  10, 30, 0), 46.55)
          Chart::AddScatterItem(#Chart, "Scatter 1", "11::30", Date(2019, 1, 1,  11, 30, 0), 46.27)
          Chart::AddScatterItem(#Chart, "Scatter 1", "12::30", Date(2019, 1, 1,  12, 30, 0), 46.77)
        EndIf
        Chart::DisplayScatterPlot(#Chart, "Scatter 1", #True)
       
        Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf


When hovering over a point, only the value is displayed (with no rounding) instead of what was specified using Chart::ToolTipText.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Chart - Gadget
PostPosted: Fri Mar 20, 2020 6:52 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 1265
Location: Germany
Bugfixes

_________________
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Chart - Gadget
PostPosted: Fri Mar 20, 2020 7:13 pm 
Offline
User
User

Joined: Sun Feb 23, 2020 4:28 pm
Posts: 15
Thank you Thorsten :)

It's working great !


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] Chart - Gadget
PostPosted: Sat Mar 21, 2020 4:26 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue May 26, 2009 2:11 pm
Posts: 689
Hi!

Sometimes it would be desirable if the x-axis labels were arranged vertically,
especially for longer texts.
Is this possible with the chart gadget?

Example:
Image

_________________
Image


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 91 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye