Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIGraph improved with new features #26

Merged
merged 6 commits into from
Dec 8, 2024
Merged

Conversation

Oen44
Copy link
Collaborator

@Oen44 Oen44 commented Dec 7, 2024

People been asking me to start creating PR for larger changes so here we are.

UIGraph widget got massive update including:

  • Multiple graphs in a single widget
  • Showing value of a closest point on a line when widget is hovered
  • Better performance due to A LOT of caching
  • New Lua functions

otclient_gl_IgQCiYM1xR

Usage example

local index = self:createGraph() -- create new graph, it will return index of that graph
self:setLineWidth(index, 2) -- set line width for previously created graph
self:setLineColor(index, "#FFC04D") -- line color
self:setTextBackground(index, "#FFFFFF") -- background for the text in info box
self:setInfoText(index, "Price (gold):") -- prefix for the value in info box

for i = 1, 30 do
  self:addValue(index, math.random(0, 10 + i)) -- adding value to the graph
end

@ericcobblepot
Copy link

how to identify between the bar chart and the line chart ?

image

@Oen44
Copy link
Collaborator Author

Oen44 commented Dec 7, 2024

how to identify between the bar chart and the line chart ?

image

Bar chart is not a part of UIGraph, that is just a widget holding widgets acting as bars, no need for a completely new Widget for that.

@ericcobblepot
Copy link

ericcobblepot commented Dec 7, 2024

WARNING: [UIGraph::addValue (widget4194)] Graph of index 0 out of bounds.
WARNING: [UIGraph::addValue (widget4204)] Graph of index 0 out of bounds.
WARNING: [UIGraph::addValue (widget4218)] Graph of index 0 out of bounds.
WARNING: [UIGraph::addValue (widget4252)] Graph of index 0 out of bounds.
WARNING: [UIGraph::addValue (widget4264)] Graph of index 0 out of bounds.

it breaks vbot 4.8 analyzer

@Oen44
Copy link
Collaborator Author

Oen44 commented Dec 7, 2024

WARNING: [UIGraph::addValue (widget4194)] Graph of index 0 out of bounds.
WARNING: [UIGraph::addValue (widget4204)] Graph of index 0 out of bounds.
WARNING: [UIGraph::addValue (widget4218)] Graph of index 0 out of bounds.
WARNING: [UIGraph::addValue (widget4252)] Graph of index 0 out of bounds.
WARNING: [UIGraph::addValue (widget4264)] Graph of index 0 out of bounds.

it breaks vbot 4.8 analyzer

Oh my god... Forgot about the stupid bot.

@Oen44
Copy link
Collaborator Author

Oen44 commented Dec 7, 2024

Fixed (I hope)

@ericcobblepot
Copy link

at least in my test,

I have a crash .-
exception thrown here
minValue = *minValueIter;

also many people will have to clear the cache(AppData\Roaming\OTClientV8\otclientv8\bot) or modify analyzer.lua(appdata), as the changes will not be reflected there.

@Oen44
Copy link
Collaborator Author

Oen44 commented Dec 7, 2024

I have a crash .- exception thrown here minValue = *minValueIter;

Ah, that makes sense, fixing.

also many people will have to clear the cache(AppData\Roaming\OTClientV8\otclientv8\bot) or modify analyzer.lua(appdata), as the changes will not be reflected there.

There is nothing I can do about it.

@ericcobblepot
Copy link

no crash, but this still appears

WARNING: [UIGraph::addValue (widget6487)] Graph of index 0 out of bounds.
WARNING: [UIGraph::addValue (widget6417)] Graph of index 0 out of bounds.
WARNING: [UIGraph::addValue (widget6427)] Graph of index 0 out of bounds.
WARNING: [UIGraph::addValue (widget6441)] Graph of index 4 out of bounds.
WARNING: [UIGraph::addValue (widget6475)] Graph of index 0 out of bounds.

@Oen44
Copy link
Collaborator Author

Oen44 commented Dec 7, 2024

no crash, but this still appears

WARNING: [UIGraph::addValue (widget6487)] Graph of index 0 out of bounds.
WARNING: [UIGraph::addValue (widget6417)] Graph of index 0 out of bounds.
WARNING: [UIGraph::addValue (widget6427)] Graph of index 0 out of bounds.
WARNING: [UIGraph::addValue (widget6441)] Graph of index 4 out of bounds.
WARNING: [UIGraph::addValue (widget6475)] Graph of index 0 out of bounds.

Ye, forgot to use index, fixed

@ericcobblepot
Copy link

ericcobblepot commented Dec 7, 2024

Shouldn't the graphics be on the same scale? (mathematically speaking)
if
for i = 1, 15 do-- yellow
for i = 1, 8 do --red
for i = 1, 30 do -- blue
the graph should look like this
image

not like this
image

@Oen44
Copy link
Collaborator Author

Oen44 commented Dec 7, 2024

Then graphs with few (and smaller) values would be barely visible against graphs with a lot of values.

However I do see your point, since on my gifs I put the min-max values on the left side (its all separated widgets and not even based on the actual values), it doesn't make sense that the highest value of a graph is way lower than the one on the left and being drawn at the top of the graph.

@ericcobblepot
Copy link

And how would the graph be interpreted?

If:
for i = 1, 15 do -- gold
for i = 1, 8 do -- panties
for i = 1, 30 do -- points

Example:
I understand that your graph tries to show the value of a certain item over a calendar month, from November 4th to December 4th.
I look at this graph and I say:
On December 3rd, 2024, a certain item had a value of 0 points, 60 panties, or 210 gold.
image

But that interpretation is incorrect, because there are data for panties only until November 12th, and for gold only until November 19th.

@Oen44
Copy link
Collaborator Author

Oen44 commented Dec 7, 2024

And how would the graph be interpreted?

If: for i = 1, 15 do -- gold for i = 1, 8 do -- panties for i = 1, 30 do -- points

Example: I understand that your graph tries to show the value of a certain item over a calendar month, from November 4th to December 4th. I look at this graph and I say: On December 3rd, 2024, a certain item had a value of 0 points, 60 panties, or 210 gold. image

But that interpretation is incorrect, because there are data for panties only until November 12th, and for gold only until November 19th.

Edited just as you posted. You shouldn't be paying attention to these labels, they are not part of the UIGraph, just separated and hardcoded labels. In my case I would never have different amount of points on each graph, they would share same number (based on selected time period at the top).

These loops and all is just a simple example to showcase different lines, different points, values and so on. Its not a real-use example.

@Oen44 Oen44 merged commit 2ebd10a into OTAcademy:master Dec 8, 2024
0 of 4 checks passed
@Oen44 Oen44 deleted the uigraph branch December 14, 2024 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants