[Module] Chart - Gadget
Re: [Module] Chart - Gadget
Thanks Thorsten1867
Your help is appreciated
Your help is appreciated
- Thorsten1867
- Addict
- Posts: 1366
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
Re: [Module] Chart - Gadget
I took a look at the code and actually it should already work.
Have you ever tried this:
Have you ever tried this:
Code: Select all
Chart::SetAttribute(#Chart, Chart::#Decimals, 2)
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Re: [Module] Chart - Gadget
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
The tooltip show rounded value too. And the chart seems to be using rounded value too.
Am I doing something wrong ?
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: Select all
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
Am I doing something wrong ?
Re: [Module] Chart - Gadget
I've updated my test code to show the rounding more clearly
- Thorsten1867
- Addict
- Posts: 1366
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
Re: [Module] Chart - Gadget
Code: Select all
Chart::SetAttribute(#Chart, Chart::#MaximumY, 48.5)
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
- Thorsten1867
- Addict
- Posts: 1366
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
Re: [Module] Chart - Gadget
Bugfixes
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Re: [Module] Chart - Gadget
Code: Select all
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.
Re: [Module] Chart - Gadget
Here is an image showing the rounding of value.
- Thorsten1867
- Addict
- Posts: 1366
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
Re: [Module] Chart - Gadget
Update: Floats for item data
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Re: [Module] Chart - Gadget
Thanks for the update Thorsten1867.
I finally got it working
I finally got it working
Re: [Module] Chart - Gadget
Hello Thorsten
I'm having a problem with tooltips using a scatterplot graph.
I'm using:
But the tooltip is still something like: "128.888888888" instead of "Weight: 01/03/2020 - 128.89 pounds".
I also tried with
The complete initialization code i'm using is:
What am I doing wrong ?
I'm having a problem with tooltips using a scatterplot graph.
I'm using:
Code: Select all
Chart::ToolTipText(#Gadget_Chart, Chart::#Scatter$ + ": " + Chart::#Time$ + " - " + Chart::#DataY$ + " pounds")
I also tried with
Code: Select all
Chart::ToolTipText(#Gadget_Chart, Chart::#Scatter$ + ": " + Chart::#Time$ + " - " + Chart::#Value$ + " pounds")
Code: Select all
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")
Re: [Module] Chart - Gadget
Here is a sample code that shows the problem:
When hovering over a point, only the value is displayed (with no rounding) instead of what was specified using Chart::ToolTipText.
Code: Select all
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
- Thorsten1867
- Addict
- Posts: 1366
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
Re: [Module] Chart - Gadget
Bugfixes
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Re: [Module] Chart - Gadget
Thank you Thorsten
It's working great !
It's working great !
Re: [Module] Chart - Gadget
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:
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: