I am using google chart api, I want to set labels for x axis
I am using google chart api, I want to set labels for the x axis, but the problem is the tesa labels overlap my original code is ..........
BarChart barchart1 = new BarChart(350, 200, BarChartOrientation.Vertical, BarChartStyle.Stacked);
barchart1.SetTitle("Bedrooms distribution of " + City);
barchart1.SetData(data);
barchart1.AddAxis(new ChartAxis(ChartAxisType.Bottom));
barchart1.AddAxis(new ChartAxis(ChartAxisType.Left));
ChartAxis chx1 = new ChartAxis(ChartAxisType.Bottom);
for (int s = 0; s < ds.Tables[0].Rows.Count; s++)
{
ChartAxisLabel chl1 = new ChartAxisLabel(labels[s]);
chx1.AddLabel(chl1);
}
barchart1.AddAxis(chx1);
barchart1.SetBarWidth(20);
// barchart1.SetLegend(labels);
barchart1.SetDatasetColors(new string[] { "FF0000", "FFFF00", "CCCCCC", "EFEFEF", "FFFF00", "9900FF", "66FF99", "00AA00", "224499", "00CC33" });
Image1.ImageUrl = barchart1.GetUrl();
Image1.Visible = true;
0
a source to share
2 answers
If you only want one simple chart (with variable values), you can create a URL for that chart (you will need to understand the basic chart API). Then use System.Net.webclient to load the diagram
using System;
using System.Net;
using System.IO;
public class Test
{
public static void Main (string[] args)
{
WebClient client = new WebClient ();
Stream data = client.OpenRead (args[0]);
StreamReader reader = new StreamReader (data);
string s = reader.ReadToEnd ();
Console.WriteLine (s);
data.Close ();
reader.Close ();
}
}
0
a source to share