//+------------------------------------------------------------------+ //| PieChartSample.mq5 | //| Copyright 2000-2025, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2000-2025, MetaQuotes Ltd." #property link "https://www.mql5.com" #property description "Example of using pie chart" //--- #include //+------------------------------------------------------------------+ //| inputs | //+------------------------------------------------------------------+ input int Width=600; input int Height=450; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ int OnStart(void) { //--- check if(Width<=0 || Height<=0) { Print("Too simple."); return(-1); } //--- create chart CPieChart pie_chart; if(!pie_chart.CreateBitmapLabel("PieChart",10,10,Width,Height)) { Print("Error creating pie chart: ",GetLastError()); return(-1); } pie_chart.ShowPercent(); //--- draw for(uint i=0;i<30;i++) { pie_chart.ValueAdd(100*(i+1),"Item "+IntegerToString(i)); Sleep(10); } Sleep(2000); //--- disable legend pie_chart.LegendAlignment(ALIGNMENT_LEFT); Sleep(2000); //--- disable legend pie_chart.LegendAlignment(ALIGNMENT_RIGHT); Sleep(2000); //--- disable legend pie_chart.LegendAlignment(ALIGNMENT_TOP); Sleep(2000); //--- disable legend pie_chart.ShowLegend(false); Sleep(2000); //--- disable percentage pie_chart.ShowPercent(false); Sleep(2000); //--- disable descriptors pie_chart.ShowDescriptors(false); Sleep(2000); //--- enable all pie_chart.ShowLegend(); pie_chart.ShowValue(); pie_chart.ShowDescriptors(); Sleep(2000); //--- or like this pie_chart.ShowFlags(FLAG_SHOW_LEGEND|FLAG_SHOW_DESCRIPTORS|FLAG_SHOW_PERCENT); uint total=pie_chart.DataTotal(); //--- play with values for(uint i=0;i