Chart widget
Moderator: Forum Moderators
Chart widget
As mentioned in https://wiki.wesnoth.org/NotSoEasyCoding#Gold_graph it is desired to have a chart widget to show several variables.
This is a concept for the chart widget (at the moment without legend) written for GUI2. At the moment it is just a stub with dummy data, but you can find a first insight right here.
If you are interested in the implementation, have a look at my GitHub: https://github.com/spixi/wesnoth/tree/chart_engine
The proposed WML syntax is:
Do you have any tips for the implementation or any other ideas?
This is a concept for the chart widget (at the moment without legend) written for GUI2. At the moment it is just a stub with dummy data, but you can find a first insight right here.
If you are interested in the implementation, have a look at my GitHub: https://github.com/spixi/wesnoth/tree/chart_engine
The proposed WML syntax is:
Code: Select all
[chart]
scaling=linear|logarithmic
[data]
label= _ "turn number"
[dataset]
color=0,255,0,255
label= _ "gold"
values=1,3,5,7
[/dataset]
[dataset]
color=255,0,0,255
label= _ "units killed"
values=0,0,1,3,4
[/dataset]
[/data]
[/chart]
Re: Chart widget
I made a big update to the chart widget. See my original post above.
Re: Chart widget
Can this widget also show bar charts like in the attack prediction dialog?
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Re: Chart widget
Hello gtgtdf,gfgtdf wrote:Can this widget also show bar charts like in the attack prediction dialog?
this should be easy to implement.
This requires new key
type=
in the data
tag to switch between line and bar chart. The only difference is that I have to draw rectangles instead of lines. We could even allow mixed charts with a bar chart in the background and a line chart in the foreground with multiple data
tags. Currently I am very busy and the weather is great outside, so I am going to implement your idea, if I find some time for this. (At the moment the data
tag is not yet read; I use hard-coded values in the proof of concept.)Re: Chart widget
Ok, i was asking becaue we want to port the attack prediction dialog to gui2 and we still need a widget to show the chart there. The have not decided yet which type of chart would fit best.
Does this widget now work fine already for line charts?
Do you intend ot make a pull request on github with this?
Does this widget now work fine already for line charts?
Do you intend ot make a pull request on github with this?
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Re: Chart widget
As said, this widget uses hard-coded values at the moment. The config data is already available, but the parser part is still missing. The legend is also not implemented yet. Unfortunately I have not much time for the implementation. I'll try to do what I can when I get some free time. The line chart is better to show progressions and trends, bar charts are better to compare absolute values. I feel that a bar chart would be the better way for the attack prediction dialog.gfgtdf wrote:Ok, i was asking becaue we want to port the attack prediction dialog to gui2 and we still need a widget to show the chart there. The have not decided yet which type of chart would fit best.
Does this widget now work fine already for line charts?
Do you intend ot make a pull request on github with this?
- Celtic_Minstrel
- Developer
- Posts: 2290
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Chart widget
I agree on a bar chart being better for attack prediction. Note that there are two orientations for a bar chart, and supporting both could be useful.
Anyway, the concept image looks great, so I'll look forward to seeing this finished.
Anyway, the concept image looks great, so I'll look forward to seeing this finished.