ui.Chart.setSeriesNames
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
แสดงผลสำเนาของแผนภูมินี้พร้อมชื่อชุดข้อมูลที่อัปเดตแล้ว
การใช้งาน | การคืนสินค้า |
---|
Chart.setSeriesNames(seriesNames, seriesIndex) | ui.Chart |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
ดังนี้ ui.chart | ui.Chart | อินสแตนซ์ ui.Chart |
seriesNames | Dictionary|Dictionary<String>|List|List<String>|String | ชื่อซีรีส์ใหม่ หากเป็นสตริง ระบบจะตั้งชื่อซีรีส์ที่ seriesIndex เป็น seriesNames หากเป็นรายการ ระบบจะใช้ค่าที่ดัชนี i ในรายการเป็นป้ายกำกับสำหรับหมายเลขชุดข้อมูล i หากเป็นพจนานุกรมหรือออบเจ็กต์ ระบบจะถือว่าเป็นแผนที่จากชื่อซีรีส์ที่มีอยู่ไปยังชื่อซีรีส์ใหม่ ใน 2 กรณีสุดท้าย ระบบจะไม่สนใจ seriesIndex |
seriesIndex | หมายเลข (ไม่บังคับ) | ดัชนีของซีรีส์ที่จะเปลี่ยนชื่อ ระบบจะไม่สนใจหาก seriesNames เป็นรายการหรือพจนานุกรม โดยซีรีส์จะเป็นแบบ 0-indexed |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eThe \u003ccode\u003eChart.setSeriesNames\u003c/code\u003e function updates the names of series within a chart.\u003c/p\u003e\n"],["\u003cp\u003eYou can update series names using a single string, a list of names, or a dictionary mapping old names to new ones.\u003c/p\u003e\n"],["\u003cp\u003eWhen using a string or list, an optional \u003ccode\u003eseriesIndex\u003c/code\u003e argument specifies the target series (0-based indexing).\u003c/p\u003e\n"],["\u003cp\u003eThe function returns a modified copy of the chart with the updated series names, leaving the original chart unchanged.\u003c/p\u003e\n"]]],["The `Chart.setSeriesNames` function updates series names within a chart. It accepts `seriesNames` as either a string, list, or dictionary. A string renames a specific series by `seriesIndex`. A list sets series names based on their index. A dictionary maps existing series names to new ones. The function returns a new chart (`ui.Chart`) with the updated series names, leaving the original chart untouched. The `seriesIndex` argument is used only when a single string is passed to `seriesNames`.\n"],null,["# ui.Chart.setSeriesNames\n\n\u003cbr /\u003e\n\nReturns a copy of this chart with updated series names.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|------------------------------------------------------|----------|\n| Chart.setSeriesNames`(seriesNames, `*seriesIndex*`)` | ui.Chart |\n\n| Argument | Type | Details |\n|------------------|----------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `ui.chart` | ui.Chart | The ui.Chart instance. |\n| `seriesNames` | Dictionary\\|Dictionary\\\u003cString\\\u003e\\|List\\|List\\\u003cString\\\u003e\\|String | New series names. If it's a string, the name of the series at seriesIndex is set to seriesNames. If it's a list, the value at index i in the list is used as a label for series number i. If it's a dictionary or an object, it's treated as a map from existing series names to new series names. In the last two cases, seriesIndex is ignored. |\n| `seriesIndex` | Number, optional | The index of the series to rename. Ignored if seriesNames is a list or dictionary. Series are 0-indexed. |"]]