Jump to content

Excel in MTA


'LinKin

Recommended Posts

Hi guys,

I was wondering if it is possible to make something similar to what excel does with some statistics.

Excel can draw images such as this http://4.bp.blogspot.com/-jvCLRDjjyv0/U ... tortas.png

Is it possible to make something like this in MTA?

If making a circle image isn't 'possible'; Then; what about making something like a progress bar?

Something like this: http://postimg.org/image/kb05e7if1/

Where the % is taken from some player's stats (i.e Kills/Deaths)

Link to comment

You can draw a circle with dx functions. You can draw on a "render target" and then you can draw that render target with smaller height. That way it will be an ellipse (just like re-sizing a circle in Photoshop or any other image processing apps).

Link to comment

I made a quick little GUI for the Google Charts API mentioned by csmit195 above. Do take note that it uses a very basic URL based API. And is nothing over the top. Visit my thread if you want to download it.

Thanks csmit195, for mentioning the API! :lol:

Note: Resource needs permission to use fetchRemote. Remember to add it to the ACL.

Link to comment
@Dealman: Nice work man!

Do you know if there's a way to download a .png image? If there are more styles?

You can download the image using fetchRemote, it's what the GUI does. I was working on a new GUI that allows you to select all of their different styles, 2D/3D Pie Chart, Bars Vertical Solid, Venn Diagram and Line Charts.

I however decided to stop the work on it, since there's so many values you can fiddle around with to tailor it the way you want, a GUI to cover it all simply isn't feasible. I might still make one for the most simple things, but it's not a high priority at the moment.

If you give me some information on what you want, I'll see if I can make a chart for you since I am fairly acquainted with their API now. :)

Link to comment
I wanted to have a nice chart. I was looking after a 3D Pie Chart. But also, to return the image as .png (so that the background is transparent) in order to make it look stylish.

Do you think it's possible to do this?

Indeed it is, just add this to the URL;

chf=bg,s,00000000 

Link to comment

Just an example to download the image.

  
-- server side 
local img = "" 
  
function GetData(data, errno) 
     if data ~= "ERROR" then 
        outputChatBox("Image downloaded.") 
    img = data  
        if img and img ~= "" then 
            triggerClientEvent(getRootElement(), "onClientGetImage", getRootElement(), img) 
    else 
    outputChatBox("ERROR: "..errno ) 
          end 
    end 
end 
  
 addEventHandler("onResourceStart", getRootElement(), 
function (  ) 
    fetch = fetchRemote("www.example.com/some.png", GetData) 
    if fetch then 
        outputChatBox("Successfully downloaded data.") 
    else 
        outputChatBox("Error downloading data") 
    end 
end 

  
local pic = "" 
  
function renderimage() 
       dxDrawImage(0, 0, 403, 119, pic) 
end 
  
 addEvent("onClientGetImage", true ) 
addEventHandler("onClientGetImage", getRootElement(), 
function(img) 
        pic = img 
      addEventHandler("onClientRender", root, renderimage) 
end 
  
) 
  

Link to comment

Of course! This part of the URL is what defines the Chart Type;

cht=p3 

The different types I managed to find;

p = 2D Pie Chart 
p3 = 3D Pie Chart 
bvs = Bars, I assume it stands for Bars Vertical Solid 
v = Venn Diagram 
lc = Lines with Axes 
lc:nda = Lines without Axes 

Edit:

If you mean that exact chart you linked, then the answer is no. This URL based Chart API has been deprecated by Google and is no longer used.

I'm afraid their current API would be quite the hassle to integrate into MTA :(

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...