问题
I have a serial chart in amCharts. I need to set parse dates to false, but this pushes all of the data toward the left side of the graph (leaving the right half blank). If I set the Width field to Category (x axis), fixing the pushed data, the data appearance colors become too wide. I tried changing some of the formatting, but these changes did not seem to have any effect
{
"type": "serial",
"categoryField": "Category",
"dataDateFormat": "",
"autoMarginOffset": 40,
"marginRight": 60,
"marginTop": 60,
"backgroundAlpha": 0.54,
"backgroundColor": "#FFF8F8",
"color": "#5C2C2C",
"fontFamily": "",
"fontSize": 13,
"handDrawThickness": 0,
"theme": "black",
"categoryAxis": {
"autoRotateAngle": 0,
"dateFormats": [
{
"period": "fff",
"format": "JJ:NN:SS"
},
{
"period": "ss",
"format": "JJ:NN:SS"
},
{
"period": "mm",
"format": "JJ:NN"
},
{
"period": "hh",
"format": "JJ:NN"
},
{
"period": "DD",
"format": "MMM DD"
},
{
"period": "WW",
"format": "MMM DD"
},
{
"period": "MM",
"format": "MMM"
},
{
"period": "YYYY",
"format": "YY"
}
],
"minPeriod": "YYYY",
"widthField": "Category",
"dashLength": 6,
"title": "Local Position, Time in 'United State of Pop 2008'",
"titleRotation": 0
},
"chartCursor": {
"enabled": true,
"animationDuration": 0,
"balloonPointerOrientation": " vertical",
"categoryBalloonDateFormat": "YY"
},
"chartScrollbar": {
"enabled": true
},
"trendLines": [],
"graphs": [
{
"balloonText": "<b>[[Melodytext]] </b>([[category]], [[value]])",
"bullet": "square",
"bulletBorderAlpha": 1,
"bulletColor": "#2EC0B1",
"bulletSize": 5,
"columnWidth": 0.44,
"cornerRadiusTop": 8,
"fillAlphas": 1,
"fillColors": "#36D9C8",
"id": "Melody",
"lineAlpha": 0.44,
"title": "Melody",
"type": "column",
"valueField": "Melodydata"
},
{
"balloonText": "<b>[[Melodytext2]] </b>([[category]], [[value]])",
"bullet": "square",
"bulletBorderAlpha": 1,
"bulletColor": "#2EC0B1",
"bulletSize": 5,
"columnWidth": 0.44,
"cornerRadiusTop": 8,
"fillAlphas": 1,
"fillColors": "#36D9C8",
"id": "Melody2",
"lineAlpha": 0.44,
"title": "Melody2",
"type": "column",
"valueField": "Melodydata2"
},
{
"balloonText": "<b>[[Melodytext3]] </b>([[category]], [[value]])",
"bullet": "square",
"bulletBorderAlpha": 1,
"bulletColor": "#2EC0B1",
"bulletSize": 5,
"columnWidth": 0.44,
"cornerRadiusTop": 8,
"fillAlphas": 1,
"fillColors": "#36D9C8",
"id": "Melody3",
"lineAlpha": 0.44,
"title": "Melody3",
"type": "column",
"valueField": "Melodydata3"
},
{
"balloonText": "<b>[[Instrumentaltext]] </b>([[category]], [[value]])",
"bullet": "triangleUp",
"bulletAlpha": 0,
"bulletBorderAlpha": 1,
"bulletColor": "#F21D1D",
"bulletHitAreaSize": -5,
"bulletSize": 5,
"fixedColumnWidth": -5,
"id": "Instrumental",
"lineColor": "#E56565",
"title": "Instrumental",
"valueField": "Instrumentaldata"
},
{
"balloonText": "<b>[[Instrumentaltext2]] </b>([[category]], [[value]])",
"bullet": "triangleUp",
"bulletBorderAlpha": 1,
"bulletBorderThickness": 1,
"bulletColor": "#F21D1D",
"bulletSize": 5,
"id": "Instrumental2",
"lineColor": "#E56565",
"title": "Instrumental2",
"valueField": "Instrumentaldata2"
},
{
"balloonText": "<b>[[aMelodytext]] [[aMelodytext2]] [[aMelodytext3]] [[aMelodytext4]]</b> ([[category]], [[value]])",
"bullet": "square",
"bulletColor": "#5C574A",
"bulletHitAreaSize": 1,
"bulletSize": 5,
"columnWidth": 0.44,
"cornerRadiusTop": 8,
"fillAlphas": 0.12,
"fillColors": "#5C574A",
"fixedColumnWidth": -25,
"id": "aMelody",
"lineColor": "#5C574A",
"lineThickness": 2,
"negativeLineColor": "#FFF8F8",
"title": "aMelody",
"useNegativeColorIfDown": true,
"valueField": "aMelodydata"
},
{
"bullet": "square",
"bulletBorderAlpha": 1,
"bulletColor": "#5C574A",
"bulletHitAreaSize": 1,
"bulletSize": 5,
"columnWidth": 0.44,
"cornerRadiusTop": 8,
"fillAlphas": 0.12,
"fillColors": "#5C574A",
"fixedColumnWidth": -2,
"fontSize": -1,
"id": "aMelody2",
"lineColor": "#5C2C2C",
"lineThickness": 2,
"negativeLineColor": "#FFF8F8",
"showBalloon": false,
"title": "aMelody2",
"useNegativeColorIfDown": true,
"valueField": "aMelodydata2"
},
{
"bullet": "square",
"bulletBorderAlpha": 1,
"bulletColor": "#5C574A",
"bulletHitAreaSize": 1,
"bulletSize": 5,
"columnWidth": 0.44,
"cornerRadiusTop": 8,
"fillAlphas": 0.12,
"fillColors": "#5C574A",
"fixedColumnWidth": -1,
"fontSize": -1,
"id": "aMelody3",
"lineColor": "#5C2C2C",
"lineThickness": 2,
"negativeLineColor": "#FFF8F8",
"showBalloon": false,
"title": "aMelody3",
"useNegativeColorIfDown": true,
"valueField": "aMelodydata3"
},
{
"bullet": "square",
"bulletBorderAlpha": 1,
"bulletColor": "#5C574A",
"bulletHitAreaSize": 1,
"bulletSize": 5,
"columnWidth": 0.44,
"cornerRadiusTop": 8,
"fillAlphas": 0.12,
"fillColors": "#5C574A",
"fixedColumnWidth": -1,
"fontSize": -1,
"id": "aMelody4",
"lineColor": "#5C574A",
"lineThickness": 2,
"negativeLineColor": "#FFF8F8",
"showBalloon": false,
"title": "aMelody4",
"useNegativeColorIfDown": true,
"valueField": "aMelodydata4"
}
],
"guides": [],
"valueAxes": [
{
"id": "ValueAxis-1",
"minimum": 1,
"title": "Global Position, Time bysourced samples"
}
],
"allLabels": [],
"balloon": {},
"titles": [],
"dataProvider": [
{
"Category": "1",
"Melodydata": "",
"Melodytext": "",
"Melodydata2": "",
"Melodytext2": "",
"Melodydata3": "",
"Melodytext3": "",
"Instrumentaldata": "1",
"Instrumentaltext": "text",
"Instrumentaldata2": "",
"Instrumentaltext2": "",
"aMelodydata": "",
"aMelodytext": "",
"aMelodydata2": "",
"aMelodytext2": "",
"aMelodydata3": "",
"aMelodytext3": "",
"aMelodydata4": "",
"aMelodytext4": ""
},
来源:https://stackoverflow.com/questions/40411203/amcharts-width-field-and-parsing-dates