• Welcome to Simple Machines Community Forum. Please login or sign up.
January 16, 2022, 03:17:49 PM

News:

SMF 2.0.19 has been released! Please update. Read more.


Simple Chart

Started by Akyhne, October 25, 2012, 11:37:07 PM

Previous topic - Next topic

Jade Elizabeth

I have a small forum theme and I want the pie to be 200-400px but it's HUGE. I can't make it smaller....any advice please? :)
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Akyhne

Hi Jade.

I haven't found a proper method to resize the svg files the way I want yet.
I have fixed a few things, regarding the pies. A new silent update has been made to the download page.

So for now, all you can do, is to edit the script that generates the BBC. It's located in your Sources folder ./Sources/Subs-SimpleChart.php

On line #217:
<object' . ($no_of_values > 40 ? ' width="1050px"' : ($no_of_values > 20 ? ' width="840px"' : ' width="630px"')) . ' height="430px" class="pie_object" data="' . $boardurl . '/Simple_Chart/SimplePie.php?data=' . $pie_data . '&amp;max=' . $chart_ceil . '" ></object>

Change to...
<object' . ($no_of_values > 40 ? ' width="525px"' : ($no_of_values > 20 ? ' width="420px"' : ' width="315px"')) . ' height="215px" class="pie_object" data="' . $boardurl . '/Simple_Chart/SimplePie.php?data=' . $pie_data . '&amp;max=' . $chart_ceil . '" ></object>
This will reduce the size to 50% (way to small for my eyes). You may find the fonts to be a bit to small. If so, edit ./Simple_Chart/css/pie.css

On line #13
text
{
font-size: 14px;
}


Edit to the font-size you want.

Please remember to download Simple Chart v 0.5 again and upload to your server, before making any changes!

Jessica.

okay here's my info
http://testplace.net23.net/index.php
Username: Test
Password: test123


EDIT: I figured out the problem. I had that view source thing enabled...
Testing Zone - SMF 2.0.7, default Curve
School & Chat - phpBB3, over 170 mods installed, official live forum

I use the latest version of Chrome

phpBB: Forum = a section; Board = whole site
SMF: Forum = whole site; Board = a section

Akyhne

Except for the fact that your forum theme is somehow broken, the dropdown works as it should.

Jessica.

Yeah it works now

What do you mean by saying my forum theme is broken? Looks fine to me..
Testing Zone - SMF 2.0.7, default Curve
School & Chat - phpBB3, over 170 mods installed, official live forum

I use the latest version of Chrome

phpBB: Forum = a section; Board = whole site
SMF: Forum = whole site; Board = a section

Akyhne

Well, try logging in with your test account. The theme is broken. If you don't see it, I'll post a screenshot.

Jessica.

Okay I did that but it still looks fine. I'm using Chrome. Are you using a different browser or something? I guess you should post a screenshoot >_<
Testing Zone - SMF 2.0.7, default Curve
School & Chat - phpBB3, over 170 mods installed, official live forum

I use the latest version of Chrome

phpBB: Forum = a section; Board = whole site
SMF: Forum = whole site; Board = a section

Akyhne


available


littlenicki

Hello, this looks like a great mod. Can it be backported to SMF 1.1 please? Thank you Nicole
Fomer SMF user. Switched to Invision Power Board and VBulletin

Akyhne


Jade Elizabeth

November 10, 2012, 10:50:12 PM #51 Last Edit: November 11, 2012, 02:11:37 AM by Jade Elizabeth
I upgraded and it's just not working how I expected ha ha.

I made the changes you suggested and I changed the width in SimplePie.php as well :). It's set to 490px.
http://www.bunnyrabbitsex.com/chatter/testing-pie-charts/

I made the font size in SimplePie.php 24. I'm trying to get the thing to make the height change so that text isnt hidden.


Thanks for the help Aky!! <3
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Akyhne

How are you making the line breaks?

You can't have small size pie charts and large text. You need to choose.

Adrian Malacoda

Quote from: Akyhne on November 11, 2012, 07:37:49 AM
How are you making the line breaks?

That was my work. The code looks something like this
$text = split("\n",wordwrap($chart_keys[$c][0], $line_width));

$first = true;
foreach ($text as $line)
{
if ($first)
{
$svg .= '
<g class="text_holder" onmouseover="Highlight(evt, \'cake' . $c . '\', \'text_bg' . $c . '\');" onmouseout="Unhighlight(evt, \'cake' . $c . '\', \'text_bg' . $c . '\');">
<rect id="text_bg' . $c . '" x="' . $text_offsetX . '" y="' . $text_offsetY . '" width="198" height="' . $line_height . '" stroke="none" stroke-width="0" fill-opacity="0" fill="#ccd"/>
<text text-anchor="start" x="' . ($text_offsetX + 24) . '" y="' . ($text_offsetY +13) . '" font-family="Arial" font-size="' . $fontSizeFinal . '" stroke="none" stroke-width="0" fill="#222222">' . $line . ' (' . $chart_keys[$c][1] . ')</text>
<rect id="cake' . $c . '_box" x="' . $text_offsetX . '" y="' . $text_offsetY . '" width="14" height="14" stroke="none" stroke-width="0" fill="' . $colors[$c] . '"/>
</g>';
$first = false;
}
else
{
$text_offsetY = $text_offsetY + $line_height;
$svg .= '
<g class="text_holder" onmouseover="Highlight(evt, \'cake' . $c . '\', \'text_bg' . $c . '\');" onmouseout="Unhighlight(evt, \'cake' . $c . '\', \'text_bg' . $c . '\');">
<rect id="text_bg' . $c . '" x="' . $text_offsetX . '" y="' . $text_offsetY . '" width="198" height="' . $line_height . '" stroke="none" stroke-width="0" fill-opacity="0" fill="#ccd"/>
<text text-anchor="start" x="' . ($text_offsetX + 24) . '" y="' . ($text_offsetY +13) . '" font-family="Arial" font-size="' . $fontSizeFinal . '" stroke="none" stroke-width="0" fill="#222222">' . $line . ' </text>
</g>';
}
}


where $line_width is 40.

Akyhne

Well, you can't just split that way, without making some other changes to the code. The <tspan> is also the correct way of splitting up a text.

I already made it for the next version. But it won't help a lot for Jade, if she insists on having such a tight layout. She needs text to be much smaller or live with much wider charts.

Eclipse16V

I worked with:
SMF 2 in German

Shop:
SID Giessen

Jade Elizabeth

If it would resize like the tag suggests I would have no issue at all. I will have wider layouts in certain areas but I'm forced to make the pies tiny because they don't resize.

I'll update when they resize.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

bojanbgrd

Hi there  :)

This is excellent mod, but I have a small problem, same as ®Shambles had - there is no pie or gauge images.  Stars and bars are shown perfectly, but pies and gauges not.  And there is no errors shown ???
On my test forum, everything worked perfectly.

Where could be a problem? 

Thank on your help in advance :)

Shambles

I never did resolve my issue with the pies & gauges :(

bojanbgrd

®Shambles  I found solution :)  I hope it will work in your forum too :)

Firstly, I changed file Subs-SimpleChart.php  by replacing all  /Simple_Chart with /Simple/Simple_Chart. I have uploaded  Subs-SimpleChart.php here so you can see the changes I've made  (sorry for my English :( )

Than, in root, I put folder named Simple and put Simple_Chart folder inside that folder and everything worked like a charm :D


Advertisement: