[Module] Chart - Gadget

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
diskay
User
User
Posts: 25
Joined: Sun Aug 02, 2015 7:17 pm

Re: [Module] Chart - Gadget

Post by diskay »

Refer to the code here :)
https://github.com/mity/mctrl
Image
zikitrake
Addict
Addict
Posts: 834
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: [Module] Chart - Gadget

Post by zikitrake »

Thorsten1867 wrote:A chart with horizontal bars and a line chart are planned.
Yeah!
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Chart - Gadget

Post by Thorsten1867 »

Update: Bar Chart with horizontal bars

Image
Last edited by Thorsten1867 on Fri Dec 20, 2019 3:16 pm, edited 1 time in total.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Chart - Gadget

Post by Thorsten1867 »

diskay wrote:Refer to the code here :)
https://github.com/mity/mctrl
Nice, but only for Windows.
My module should also work under MacOS and Linux. :D
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
zikitrake
Addict
Addict
Posts: 834
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: [Module] Chart - Gadget

Post by zikitrake »

Could you check why vertical axis values are duplicated?

I am using Example 1 (automatically adjust maximum value), but it happens exactly the same with other examples and using the attribute 'Chart::#Maximum'

Image

Thank you!
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Chart - Gadget

Post by Thorsten1867 »

Update: Line Chart

Image

@zikitrake
Bug fixed
Last edited by Thorsten1867 on Fri Dec 20, 2019 3:17 pm, edited 1 time in total.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
zikitrake
Addict
Addict
Posts: 834
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: [Module] Chart - Gadget

Post by zikitrake »

Thorsten1867 wrote:Update: Line Chart

Image
I love you!! :D
Thorsten1867 wrote: @zikitrake
Bug fixed
Very much!
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Chart - Gadget

Post by Thorsten1867 »

@zikitrake
Line charts become really interesting if they are combined with data series. :wink:

Update: Line chart for data series

Image
Last edited by Thorsten1867 on Fri Dec 20, 2019 3:18 pm, edited 1 time in total.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
zikitrake
Addict
Addict
Posts: 834
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: [Module] Chart - Gadget

Post by zikitrake »

Thorsten1867 wrote:@zikitrake
Line charts become really interesting if they are combined with data series. :wink:
...
Nice! :D

This is really interesting for me, as I plan to add graphics of this style to my project:
Image


Would it be possible to:
- Add an option to hide the labels of the series? (I would put them manually in a List Gadget)
- Invert vertical values from top to bottom? as this image
Image

Really thank you!
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Chart - Gadget

Post by Thorsten1867 »

Update:
  • Added: #Hide for hiding legend
  • Addes: #Descending for descending numbering of the y-axis in line charts
  • Bugfixes
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
zikitrake
Addict
Addict
Posts: 834
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: [Module] Chart - Gadget

Post by zikitrake »

Thorsten1867 wrote:Update:
  • Added: #Hide for hiding legend
  • Addes: #Descending for descending numbering of the y-axis in line charts
  • Bugfixes
:shock: Yeah, it works like a charm!
Sorry to be so heavy asking for additions but, hey! you're creating a first class module :oops:

Again, thank you so much!

Edit:An issue when #Descendig is activated: Chart::SetAttribute(#Chart, Chart::#Minimum, 1) is ignored :)
zikitrake
Addict
Addict
Posts: 834
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: [Module] Chart - Gadget

Post by zikitrake »

More about previous comented issue

This image is made when #descending is activated and define a Chart::SetAttribute(#Chart, Chart::#Minimum, 1)
Image

I did a change in Procedure DrawLineChart_(), changing

Code: Select all

Range = Maximum - Minimum
to

Code: Select all

If Chart()\Line\Flags & #Descending
  Range = Maximum
Else
   Range = Maximum - Minimum
EndIf
And

Code: Select all

Text$ = Str(Factor * n)
to

Code: Select all

Text$ = Str(Factor * n + Minimum)
Then it seem to works fine
Image

PS: I'm sure my code is a botched job. :lol:
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Chart - Gadget

Post by Thorsten1867 »

@ zikitrake
Bug fixed and another little bonus.


Update: Bezier curves for line charts (#BezierCurve)

Image
Last edited by Thorsten1867 on Fri Dec 20, 2019 3:20 pm, edited 1 time in total.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
zikitrake
Addict
Addict
Posts: 834
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: [Module] Chart - Gadget

Post by zikitrake »

Thorsten1867 wrote:@ zikitrake
Bug fixed and another little bonus.
Update: Bezier curves for line charts (#BezierCurve)
Nice!!!
Image
zikitrake
Addict
Addict
Posts: 834
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: [Module] Chart - Gadget

Post by zikitrake »

Turning with the petitions!

- Do you plan to add Tooltips to items? I modified your code (awkwardly) to add a MouseMove event, but it doesn't go very fine :)
Image


- (I don't know whether to consider this a request because I don't know if it will be of general interest :? ) : Could you make a value be hidden when it exceeds the Chart::#Minimum/Chart::#Maximum?

For example, in this graph I have assigned minimum value = 1 and maximum value = 100. When a value exceeds 100 I would like it to be hidden (or show a label 'out' for example :) )
Image

PS: Tomorrow I'm going on a week' holiday, so I'll stop grilling you! :oops:
Post Reply