duanlachu7344 2014-01-24 10:56
浏览 45
已采纳

php Graph将标记更改为100

i have a graph and it's generating well as shown below but i want Marks (Y-axis) to end at 100 instead of 125 enter image description here
Here is the sample index.php

<?php 
    require "chart/chart.php";
        $chart = new KoolChart("chart");
        $chart->scriptFolder="chart";
        $chart->Width = 900;
        $chart->Title->Text = "Student Marks";
        $chart->PlotArea->XAxis->Title = "Tests";
        $chart->PlotArea->XAxis->Set(array("Semester 1","Semester 2","Semester 3"));
        $chart->PlotArea->YAxis->Title = "Marks";
        **$chart->PlotArea->YAxis->LabelsAppearance->DataFormatString = " {0}";**
        $series = new LineSeries();
        $series->Name = "Progess Graph";
        $series->ArrayData(array($test1,$test2,$test3));
     $chart->PlotArea->AddSeries($series);
    ?>

The line in ** ** above is the one responsible for Y-axis.

Here is chart/chart.php http://pastebin.com/96TvRcah

Any help please?

  • 写回答

1条回答 默认 最新

  • douweilei2307 2014-01-24 11:01
    关注

    According to this documentation you need the following:

    $chart->PlotArea->YAxis->MinValue = 0;
    $chart->PlotArea->YAxis->MaxValue = 100;
    $chart->PlotArea->YAxis->MajorStep = 10;
    $chart->PlotArea->YAxis->MinorStep = 2;
    

    So complete code would be:

    <?php 
        require "chart/chart.php";
        $chart = new KoolChart("chart");
        $chart->scriptFolder="chart";
        $chart->Width = 900;
        $chart->Title->Text = "Student Marks";
        $chart->PlotArea->XAxis->Title = "Tests";
        $chart->PlotArea->XAxis->Set(array("Semester 1","Semester 2","Semester 3"));
        $chart->PlotArea->YAxis->Title = "Marks";
        $chart->PlotArea->YAxis->MinValue = 0;
        $chart->PlotArea->YAxis->MaxValue = 100;
        $chart->PlotArea->YAxis->MajorStep = 10;
        $chart->PlotArea->YAxis->MinorStep = 2;
        $chart->PlotArea->YAxis->LabelsAppearance->DataFormatString = " {0}";
        $series = new LineSeries();
        $series->Name = "Progess Graph";
        $series->ArrayData(array($test1,$test2,$test3));
        $chart->PlotArea->AddSeries($series);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥99 关于#javascript#的问题:怎么样写一个浏览器插件的js,填充浏览器元素:
  • ¥15 关于#hadoop#的问题:按照老师上课讲的步骤写的
  • ¥20 有人会用这个工具箱吗 付fei咨询
  • ¥30 成都市武侯区住宅小区兴趣点
  • ¥15 Windows软实时
  • ¥15 自有服务器搭建网络隧道并且负载均衡
  • ¥15 opencv打开dataloader显示为nonetype
  • ¥15 MacOS 80端口外网无法访问
  • ¥50 js逆转反解密-会的来
  • ¥15 wrodpress如何调取数据库并展示
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部