Jump to content
Software FX Community

x-axis-labels not showing


Tobias
 Share

Recommended Posts

I'm having trouble getting my x-axis labels to show.

<chartfx7:Chart ID="Chart1" runat="server" ContextMenus="False" Width="300px" Height="200px">  <Series>   <chartfx7:SeriesAttributes Gallery="Lines" Color="Red" MarkerShape="None" Text="gräns 1" />   <chartfx7:SeriesAttributes Gallery="Lines" Color="Red" MarkerShape="None" Text="gräns 2" />   <chartfx7:SeriesAttributes Color="153, 204, 255" Gallery="Lines" Text="bud" />   <chartfx7:SeriesAttributes Color="51, 102, 255" Gallery="Lines" Text="prev" />   <chartfx7:SeriesAttributes Color="0, 0, 0" Gallery="Bar" Text="value" />  </Series>  <AllSeries Gallery="Bar"></AllSeries>  <LegendBox Visible="False"></LegendBox>  <SpecialObjects>   <chartfxadornments:SimpleBorder AssemblyName="ChartFX.WebForms.Adornments" Type="None"></chartfxadornments:SimpleBorder>   <chartfxadornments:SolidBackground AssemblyName="ChartFX.WebForms.Adornments"></chartfxadornments:SolidBackground>   <chartfx7galleries:Bar></chartfx7galleries:Bar>  </SpecialObjects>  <AxisY Title-Text="" LabelsFormat-Format="Currency"></AxisY>  <AxisX Title-Text="Period" LabelAngle="45" LabelsFormat-Format="Number"></AxisX>  <MainPane AxisY-Title-Text="" AxisY-Max="260000" AxisY-Min="0" /></chartfx7:Chart>

Code behind:

DataTable

dt = new DataTable();dt.Columns.Add("period");dt.Columns.Add("grans1");dt.Columns.Add("grans2");dt.Columns.Add("value");dt.Columns.Add("bud");dt.Columns.Add("prev");

DataRow dr = dt.NewRow();dr.ItemArray = new Object[] { "200801", 130000, 250000, 20000, 23000, 25000 };dt.Rows.Add(dr);dr = dt.NewRow();dr.ItemArray = new Object[] { "200802", 130000, 250000, 40000, 38000, 42000 };dt.Rows.Add(dr);dr = dt.NewRow();

// ...up to 200812

Chart1.AxisX.LabelsFormat.Format = ChartFX.WebForms.

AxisFormat.None;Chart1.AxisY.LabelsFormat.Culture = new System.Globalization.CultureInfo("sv-SE");

Chart1.DataSourceSettings.Fields.Add(new ChartFX.WebForms.FieldMap("period", ChartFX.WebForms.FieldUsage.XValue));Chart1.DataSourceSettings.Fields.Add(new ChartFX.WebForms.FieldMap("grans1", ChartFX.WebForms.FieldUsage.Value));Chart1.DataSourceSettings.Fields.Add(new ChartFX.WebForms.FieldMap("tgrans2", ChartFX.WebForms.FieldUsage.Value));Chart1.DataSourceSettings.Fields.Add(new ChartFX.WebForms.FieldMap("budt", ChartFX.WebForms.FieldUsage.Value));Chart1.DataSourceSettings.Fields.Add(new ChartFX.WebForms.FieldMap("prev", ChartFX.WebForms.FieldUsage.Value));Chart1.DataSourceSettings.Fields.Add(new ChartFX.WebForms.FieldMap("value", ChartFX.WebForms.FieldUsage.Value));Chart1.DataSource = dt;Chart1.DataBind();

I have also tried to explicitly apply a value:

Chart1.AxisX.Labels[0] = "Jan";Chart1.AxisX.Labels[1] = "Feb";

...but no success. Any help is appreciated!

Link to comment
Share on other sites

Since "period" is a string, you want to assign it as labels not as X-Values:

Chart1.DataSourceSettings.Fields.Add(new ChartFX.WebForms.FieldMap("period", ChartFX.WebForms.FieldUsage.Label));

 Also, your columns don't have a type, therefore, they are all String Columns. You can change that by doing:

dt.Columns.Add("grans1", typeof(double));

Link to comment
Share on other sites

  • 2 years later...

Hi frank

 I have the same type of a issue. hope you can help me with that.

I have a string value which should be used as the X axis value,but it in not poissible, So i created another series with numbers corresponding to the text keys,and then added the string series as KeyLable. But key values are not displayed. Please help me to solve this issue

pls see the code

 

  Dim dtb1 As New DataTable
  dtb1.Columns.Add("Time", Type.GetType("System.String")) 'this is lable field
  dtb1.Columns.Add("key1", Type.GetType("System.Int32")) 'this is key field

dtb1.Columns.Add("val1", Type.GetType("System.Int32")) 'this is value field

 

Chart1.DataSourceSettings.Fields.Add(New FieldMap("key1", FieldUsage.XValue))
  Chart1.DataSourceSettings.Fields.Add(New FieldMap("Time", FieldUsage.KeyLabel))
  Chart1.DataSourceSettings.Fields.Add(New FieldMap("val1", FieldUsage.Value))

 exampls data

time,key1,val1

"00",0,12

"15",15,123

"60",60,456

"60+",70,12

 the reason why i need to add a XValue field is to get a CustomGridLine.

 pls see the image below

http://community.softwarefx.com/forums/data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVgAAAELCAIAAAATFAlOAAASGUlEQVR4nO2dYZazKgyG3RN7Yk/ZU/aU+YG1jrUUFTXg85x7OFy+aZphbHhNIwwGAI9nuNsBALgfAgEAEAgAgEAAAEYgAAAjEACAEQgAwAgEAGAEAgCw8kCgqjFKjDHGGOIb+vTpO+5LjFFV6wQCEYkxiqiqqb5ao0+fvvu+agi/Y8HvQKCqMUqyQ0tL22L7Uxf8DgSjFjB7R5p3a4wzzngD46ohRtU0sDcQJFsHYxItLe19bdL1+i0WlAWCRYyZ34cwzjjjLYxPiiCxORCEGC+PXrS0tJXbOAsE9kGhIki2VN926dOn31I/fXcwYf8pCgT2tktLS9tkGw/eGqzkCMySIcYZZ7yVcXIEtLS0dRRBsqX6tkufPv2W+uQIaGlpq+YIzIw+ffot9o/mCEZFYGZm6eX06dNvrl8zR/C2S58+/ab6p+UI7GOEccYZ9zpeP0cweyfGGWe8jfFKdQRmb7v06dNvrU+OgD59+nVzBGb06dNvsV8nR/C2O/bnLeOMM+59vE4dQWL+8rklxhln3Pk4OQL69OmfkSOY/SvjjDPexPhJOQL69Om31K9TR5CYv5o+ffoN9ckR0KdPv1aOYDYyN8I444w3MU6OgD59+lXrCACgUWrnCCz15y3jjDPufbx+jmAO44wz3sQ4OQL69OlXrSMAgCOIahQNUeTjo3g2NRSBmU3RZey/DTHOOOMl4zFKiDKEsU3nlF/mT50cAQAcQURDlBA1iIWoIeoQROQ6XVAvR2Bmq/chZ46rqqRW6NNvuP/SAjq8okAamX5Gxyv/rM9X23UEnx4DtMgoB/79JyHK9ANnX+oVFEHqzF97WX/h85H+XIYdtDn55MSO/V8BDtqsOecf9667+63PuYiOiuDd/gsEFa/P1X7bOQIUAfRBjO+7gxQC5lHAmlAE85f9jzenj3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Tvmcu01cgSbrDnPEbQeCP7tKVTFJ4ATQBGskPF4i5FpTyFV9bhm+rxfRRFcb8qoI8ize67JCEBbNKAI2qojkLU9haz31cmh3jHmfJM15zmCtuoI2GUYGqUBRXCOY0WUz45m9xSy3lcnn6Yc6hSfE2XUEeQpnGv2FILWQRHk+Dk7Ou4pJD/zgn0rAodrrzHnm6w5zxF4DgQiOj5BSEYAGgdFsELG44lXRqA0L+hwzfR5v4oiuN6UUUeQZ3WulT2FoDsaUAR+6gjSs0NpH4FNewpZ76uTQ71jzPkma85zBNXrCApPQxbVKBqiTBOk055CUufZIQA/NKAIKnoz/xnYkGMEqKk7wKGIDFKlPkuw3veuu/VyacphzrF50TZ0+oISgKBiI4PC73OIA4hxQX2FIJuQREsCVFSFmCI01MDMhwuFepbEThce40532TNeY7glkAwCoHXgwNDkJAOHgHol4oftE/aUwTy+l5gyhGEKCFKRTcAnkZ7OQJLDxGmvEC9KFAx4tYy5dCl7k05dOka3NURlHx9qOkJghBTOGhpvgFc4q6O4C4cLgUOXerelEOXrsFXjgAAbsFXjuBGHC4FDl3q3pRDl64BRQAAzuoIAOAWUAQAQI4AABzWEQDA9VBHAADkCACAHAEAGIoAAIw6AgAwFAEAGDkCADDqCADAqCMAACNHAABGjgAADEUAAEYdAQAYigAAjBwBABh1BABg1BEAgJEjAAAjRwAAhiIAAKOOAAAMRQAARo4AAMwsRjleR0AhAUDDqOrRHIGqxijnuAcAV7BIEOwJBGYmIugCgOZIn/nwEQV2BgJ76YIYY4wxxDf06dN33v8ZBTYEgim6AEAH7A8ExAKAPjikCAgEAB2w+tHeFggAoEsIBABAIAAAAgEAGIEAAIxAAABGIACAYRgIBACAIgAAsz/3k1HayQ57AQAAAABJRU5ErkJggg==

your help greatly appriciated

Rgds

Nuwan

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...