0
A
답변
2
가끔 pchart2를 사용하고 설명 된 상황에서 개인적으로 pchart 코드 자체를 수정하는 경향이 있습니다.
레이블이 인쇄 된 곳을 검색하고 비틀기를 수행해야합니다. 안타깝게도, pchart의 코드는 ... 음 ... 글쎄, 제 의견으로는 좋지 않습니다. 그래서 쉽게 잃어 버릴 수 있습니다.
/**
* Insert ends of line into the given string to prevent exceeding the given width of the
* string when it is printed.
* @param unknown_type $text String for separation by EOLs.
* @param unknown_type $displayFont Font used for text printing.
* @param unknown_type $displaySize Size of the printed text.
* @param unknown_type $angle Angle of text printing.
* @param unknown_type $maximumWidth Maximum allowed width (pixels).
* @return string The edited input text.
*/
function changeTextForMaximumWidth($text, $displayFont, $displaySize, $angle, $maximumWidth) {
$result = "";
$processedText = $text;
$remainingText = "";
while ($processedText != "") {
// replace this by any routine that computes the width and height of the text
$TxtPos = $this->getTextBox(0, 0, $displayFont, $displaySize, $angle, $processedText);
// what about TXT margin??
$TxtWidth = abs($TxtPos[0]["X"] - $TxtPos[1]["X"]);
// if text length is sufficient
if ($TxtWidth <= $maximumWidth) {
$result .= $processedText;
if ($remainingText != "") {
$result .= PHP_EOL;
}
$processedText = $remainingText;
$remainingText = "";
continue;
}
// the text is too wide
// try to make it shorter
$pos = strrpos($processedText, " ");
if ($pos == FALSE) {
// cannot be made shorter
$result .= $processedText;
if ($remainingText != "") {
$result .= PHP_EOL;
}
$processedText = $remainingText;
$remainingText = "";
continue;
}
// can be shorten
$shorten = substr($processedText, 0, $pos);
$restLength = strlen($processedText) - ($pos + 1);
$rest = substr($processedText, $pos + 1, $restLength);
$processedText = $shorten;
$remainingText = $rest . " " . $remainingText;
}
return $result;
}
0
당신은에 word-wrap
기능을 사용하려고 할 수 있습니다
아마, 당신은 텍스트의 최대 허용 폭을 적용 할 하나 개 이상의 라인에 긴 텍스트를 분할하는 내 집에서 만든 기능을 주셔서 감사합니다 수 레이블의 텍스트가 짧아지고 여러 줄이 표시됩니다.
관련 문제
- 1. 긴 레이블 텍스트의 줄 바꿈
- 2. 긴 레이블 제목 문제 예 :
- 3. 처음으로 pChart 사용하기
- 4. pchart stroke 함수
- 5. Zend Framework pChart 통합
- 6. pchart zend framework error "
- 7. Pchart with mouseover
- 8. pChart 이미지를 mysql에 저장하기
- 9. 배열의 pChart 변수
- 10. Pchart - 날짜 형식
- 11. pChart - 언어 문제
- 12. 대기 시간이 긴 (?) 사용자를위한 긴 PHP 실행
- 13. pChart - 브라우저에 png 이미지 표시
- 14. PHP에서 긴 문자열 정렬 PHP
- 15. 개행 문자가없는 PHP 긴 문자열
- 16. PHP 긴 문자열을 목록으로 구분하기
- 17. PHP 매우 긴 문자열 지원
- 18. R ggplot2 여러 행에 걸쳐 긴 x 축 레이블 바꿈
- 19. pchart 오류 : 메시지 : imageftbbox() [function.imageftbbox] : 잘못된 글꼴 파일 이름
- 20. 레이블 json 레이블 대 자바 스크립트 레이블
- 21. 레이블 배열에 레이블 바인딩
- 22. PHP 응용 프로그램에 Microsoft Outlook 레이블 통합
- 23. PHP 파일에서 레이블 생성을위한 섹션 읽기
- 24. 메일 링 레이블 인쇄 - php, MySQL, FPDF
- 25. vb.net에서 레이블 값을 설정하십시오.
- 26. 레이블
- 27. 레이블
- 28. PHP : 긴 문자열을 연결할 때 문자 손실
- 29. 과도한 데이터베이스 액세스가없는 PHP 긴 폴링
- 30. jquery PHP 긴 폴링 요청 문제
x 축을 그리는 코드 스 니펫을 제공 할 수 있습니까? – jugnu
아직은 없지만이 http://pchart.sourceforge.net/screenshots.php?ID=10처럼 될 것입니다. –