YLabelStyle.as 851 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package elements.axis {
  2. import string.Utils;
  3. public class YLabelStyle
  4. {
  5. public var style:Object;
  6. public function YLabelStyle( json:Object, name:String )
  7. {
  8. this.style = { size: 10,
  9. colour: 0x000000,
  10. show_labels: true,
  11. visible: true
  12. };
  13. var comma:Number;
  14. var none:Number;
  15. var tmp:Array;
  16. if( json[name+'_label_style'] == undefined )
  17. return;
  18. // is it CSV?
  19. comma = json[name+'_label_style'].lastIndexOf(',');
  20. if( comma<0 )
  21. {
  22. none = json[name+'_label_style'].lastIndexOf('none',0);
  23. if( none>-1 )
  24. {
  25. this.style.show_labels = false;
  26. }
  27. }
  28. else
  29. {
  30. tmp = json[name+'_label_style'].split(',');
  31. if( tmp.length > 0 )
  32. this.style.size = tmp[0];
  33. if( tmp.length > 1 )
  34. this.style.colour = Utils.get_colour(tmp[1]);
  35. }
  36. }
  37. }
  38. }