'LinKin Posted January 17, 2014 Posted January 17, 2014 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)
Dzejki Posted January 17, 2014 Posted January 17, 2014 2nd one is possible to do. Just use DX functions.
Anubhav Posted January 17, 2014 Posted January 17, 2014 Possible but its realy hard. As he said use DX Functions or you can simply create a normal progress bar.
'LinKin Posted January 17, 2014 Author Posted January 17, 2014 Thank you. Do you know anything similar to this so that I can take it as an example? Because I'm thinking that a normal progress bar will not look like http://postimg.org/image/kb05e7if1/
50p Posted January 17, 2014 Posted January 17, 2014 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).
codeluaeveryday Posted January 17, 2014 Posted January 17, 2014 http://postimg.org/image/kb05e7if1/ ^^ this one is easy. Now this one is also easy: http://4.bp.blogspot.com/-jvCLRDjjyv0/U ... tortas.png ^^ google chart api. You are able to register an API key with Google Chart, and it will allow you to send data to their servers and it will return image data which is drawable with dxDrawImage.
DiSaMe Posted January 18, 2014 Posted January 18, 2014 Or just draw the chart pixel by pixel into render target.
Dealman Posted January 18, 2014 Posted January 18, 2014 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! Note: Resource needs permission to use fetchRemote. Remember to add it to the ACL.
'LinKin Posted January 20, 2014 Author Posted January 20, 2014 @Dealman: Nice work man! Do you know if there's a way to download a .png image? If there are more styles?
Dealman Posted January 20, 2014 Posted January 20, 2014 @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.
'LinKin Posted January 21, 2014 Author Posted January 21, 2014 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?
Dealman Posted January 21, 2014 Posted January 21, 2014 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
'LinKin Posted January 21, 2014 Author Posted January 21, 2014 Would be like this http://chart.googleapis.com/chart?cht=p ... s,00000000 Could you tell me how to return a 3D Chart Pie?
50p Posted January 21, 2014 Posted January 21, 2014 Would be like thishttp://chart.googleapis.com/chart?cht=p ... s,00000000 Could you tell me how to return a 3D Chart Pie? You forgot about &. So, http://chart.googleapis.com/chart?cht=p ... s,00000000
Saml1er Posted January 21, 2014 Posted January 21, 2014 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 )
'LinKin Posted January 21, 2014 Author Posted January 21, 2014 Thank you 50p and Saml1er. I meant to ask if it's posible to change the 'style' of the current Pie that this URL returns to this one: https://google-developers.appspot.com/c ... iechart#3D forexample
Dealman Posted January 21, 2014 Posted January 21, 2014 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
'LinKin Posted January 21, 2014 Author Posted January 21, 2014 I've found some additional arguments. Such as Color, etc.. Thank you!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now